blob: e730772c401b53206810ceb387aa56b9f4f06cf9 [file] [log] [blame]
Jeff Diked67b5692005-07-07 17:56:49 -07001#include "uml-config.h"
Jeff Dike54ae36f2007-10-16 01:27:33 -07002#include "as-layout.h"
Jeff Diked67b5692005-07-07 17:56:49 -07003
4 .globl syscall_stub
5.section .__syscall_stub, "x"
Jeff Dikec5600492005-09-03 15:57:36 -07006
7 .globl batch_syscall_stub
8batch_syscall_stub:
Bodo Stroesser07bf7312005-09-03 15:57:50 -07009 /* load pointer to first operation */
Jeff Dike54ae36f2007-10-16 01:27:33 -070010 mov $(ASM_STUB_DATA+8), %esp
Bodo Stroesser07bf7312005-09-03 15:57:50 -070011
12again:
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 Dike54ae36f2007-10-16 01:27:33 -070018 mov %eax, ASM_STUB_DATA+4
Jeff Dikec5600492005-09-03 15:57:36 -070019 cmpl $0, %eax
20 jz done
Bodo Stroesser07bf7312005-09-03 15:57:50 -070021
22 /* save current pointer */
Jeff Dike54ae36f2007-10-16 01:27:33 -070023 mov %esp, ASM_STUB_DATA+4
Bodo Stroesser07bf7312005-09-03 15:57:50 -070024
25 /* skip additional data */
26 add %eax, %esp
27
28 /* load syscall-# */
29 pop %eax
30
31 /* load syscall params */
Jeff Dikec5600492005-09-03 15:57:36 -070032 pop %ebx
33 pop %ecx
34 pop %edx
35 pop %esi
36 pop %edi
37 pop %ebp
Bodo Stroesser07bf7312005-09-03 15:57:50 -070038
39 /* execute syscall */
Jeff Dikec5600492005-09-03 15:57:36 -070040 int $0x80
Bodo Stroesser07bf7312005-09-03 15:57:50 -070041
42 /* check return value */
43 pop %ebx
44 cmp %ebx, %eax
45 je again
46
47done:
48 /* save return value */
Jeff Dike54ae36f2007-10-16 01:27:33 -070049 mov %eax, ASM_STUB_DATA
Bodo Stroesser07bf7312005-09-03 15:57:50 -070050
51 /* stop */
52 int3