Commit | Line | Data |
---|---|---|
37185b33 | 1 | #include <as-layout.h> |
d67b569f | 2 | |
276c974a | 3 | .section .__syscall_stub, "ax" |
c5600490 JD |
4 | |
5 | .globl batch_syscall_stub | |
6 | batch_syscall_stub: | |
07bf731e | 7 | /* load pointer to first operation */ |
4bdf8bc4 | 8 | mov $(STUB_DATA+8), %esp |
07bf731e BS |
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 */ | |
4bdf8bc4 | 16 | mov %eax, STUB_DATA+4 |
c5600490 JD |
17 | cmpl $0, %eax |
18 | jz done | |
07bf731e BS |
19 | |
20 | /* save current pointer */ | |
4bdf8bc4 | 21 | mov %esp, STUB_DATA+4 |
07bf731e BS |
22 | |
23 | /* skip additional data */ | |
24 | add %eax, %esp | |
25 | ||
26 | /* load syscall-# */ | |
27 | pop %eax | |
28 | ||
29 | /* load syscall params */ | |
c5600490 JD |
30 | pop %ebx |
31 | pop %ecx | |
32 | pop %edx | |
33 | pop %esi | |
34 | pop %edi | |
35 | pop %ebp | |
07bf731e BS |
36 | |
37 | /* execute syscall */ | |
c5600490 | 38 | int $0x80 |
07bf731e BS |
39 | |
40 | /* check return value */ | |
41 | pop %ebx | |
42 | cmp %ebx, %eax | |
43 | je again | |
44 | ||
45 | done: | |
46 | /* save return value */ | |
4bdf8bc4 | 47 | mov %eax, STUB_DATA |
07bf731e BS |
48 | |
49 | /* stop */ | |
50 | int3 |