blob: 98816804e131fcb8701f3b360055de2501a8300a [file] [log] [blame]
Al Viro37185b32012-10-08 03:27:32 +01001#include <as-layout.h>
Jeff Diked67b5692005-07-07 17:56:49 -07002
Amerigo Wang276c9742009-06-16 15:33:30 -07003.section .__syscall_stub, "ax"
Jeff Dikec5600492005-09-03 15:57:36 -07004
5 .globl batch_syscall_stub
6batch_syscall_stub:
Bodo Stroesser07bf7312005-09-03 15:57:50 -07007 /* load pointer to first operation */
Jeff Dike4bdf8bc2008-02-04 22:30:44 -08008 mov $(STUB_DATA+8), %esp
Bodo Stroesser07bf7312005-09-03 15:57:50 -07009
10again:
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 Dike4bdf8bc2008-02-04 22:30:44 -080016 mov %eax, STUB_DATA+4
Jeff Dikec5600492005-09-03 15:57:36 -070017 cmpl $0, %eax
18 jz done
Bodo Stroesser07bf7312005-09-03 15:57:50 -070019
20 /* save current pointer */
Jeff Dike4bdf8bc2008-02-04 22:30:44 -080021 mov %esp, STUB_DATA+4
Bodo Stroesser07bf7312005-09-03 15:57:50 -070022
23 /* skip additional data */
24 add %eax, %esp
25
26 /* load syscall-# */
27 pop %eax
28
29 /* load syscall params */
Jeff Dikec5600492005-09-03 15:57:36 -070030 pop %ebx
31 pop %ecx
32 pop %edx
33 pop %esi
34 pop %edi
35 pop %ebp
Bodo Stroesser07bf7312005-09-03 15:57:50 -070036
37 /* execute syscall */
Jeff Dikec5600492005-09-03 15:57:36 -070038 int $0x80
Bodo Stroesser07bf7312005-09-03 15:57:50 -070039
40 /* check return value */
41 pop %ebx
42 cmp %ebx, %eax
43 je again
44
45done:
46 /* save return value */
Jeff Dike4bdf8bc2008-02-04 22:30:44 -080047 mov %eax, STUB_DATA
Bodo Stroesser07bf7312005-09-03 15:57:50 -070048
49 /* stop */
50 int3