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