blob: 7699e89f660fd42701736ce1bfe79e4d6b2d0ddc [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 Dike4bdf8bc2008-02-04 22:30:44 -080010 mov $(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 Dike4bdf8bc2008-02-04 22:30:44 -080018 mov %eax, 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 Dike4bdf8bc2008-02-04 22:30:44 -080023 mov %esp, 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 Dike4bdf8bc2008-02-04 22:30:44 -080049 mov %eax, STUB_DATA
Bodo Stroesser07bf7312005-09-03 15:57:50 -070050
51 /* stop */
52 int3