Al Viro | 37185b3 | 2012-10-08 03:27:32 +0100 | [diff] [blame] | 1 | #include <as-layout.h> |
Jeff Dike | d67b569 | 2005-07-07 17:56:49 -0700 | [diff] [blame] | 2 | |
Amerigo Wang | 276c974 | 2009-06-16 15:33:30 -0700 | [diff] [blame] | 3 | .section .__syscall_stub, "ax" |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 4 | |
5 | .globl batch_syscall_stub | ||||
6 | batch_syscall_stub: | ||||
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 7 | /* load pointer to first operation */ |
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 8 | mov $(STUB_DATA+8), %esp |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 9 | |
10 | again: | ||||
11 | /* load length of additional data */ | ||||
12 | mov 0x0(%esp), %eax | ||||
13 | |||||
14 | /* if(length == 0) : end of list */ | ||||
15 | /* write possible 0 to header */ | ||||
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 16 | mov %eax, STUB_DATA+4 |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 17 | cmpl $0, %eax |
18 | jz done | ||||
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 19 | |
20 | /* save current pointer */ | ||||
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 21 | mov %esp, STUB_DATA+4 |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 22 | |
23 | /* skip additional data */ | ||||
24 | add %eax, %esp | ||||
25 | |||||
26 | /* load syscall-# */ | ||||
27 | pop %eax | ||||
28 | |||||
29 | /* load syscall params */ | ||||
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 30 | pop %ebx |
31 | pop %ecx | ||||
32 | pop %edx | ||||
33 | pop %esi | ||||
34 | pop %edi | ||||
35 | pop %ebp | ||||
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 36 | |
37 | /* execute syscall */ | ||||
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 38 | int $0x80 |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 39 | |
40 | /* check return value */ | ||||
41 | pop %ebx | ||||
42 | cmp %ebx, %eax | ||||
43 | je again | ||||
44 | |||||
45 | done: | ||||
46 | /* save return value */ | ||||
Jeff Dike | 4bdf8bc | 2008-02-04 22:30:44 -0800 | [diff] [blame] | 47 | mov %eax, STUB_DATA |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 48 | |
49 | /* stop */ | ||||
50 | int3 |