blob: 54a36ec20cb75c32b65a7e0e28043a8c19c6a6f0 [file] [log] [blame]
Jeff Dike54ae36f2007-10-16 01:27:33 -07001#include "as-layout.h"
Jeff Diked67b5692005-07-07 17:56:49 -07002
3 .globl syscall_stub
Amerigo Wang276c9742009-06-16 15:33:30 -07004.section .__syscall_stub, "ax"
Jeff Dikec5600492005-09-03 15:57:36 -07005
6 .globl batch_syscall_stub
7batch_syscall_stub:
Bodo Stroesser07bf7312005-09-03 15:57:50 -07008 /* load pointer to first operation */
Jeff Dike4bdf8bc2008-02-04 22:30:44 -08009 mov $(STUB_DATA+8), %esp
Bodo Stroesser07bf7312005-09-03 15:57:50 -070010
11again:
12 /* load length of additional data */
13 mov 0x0(%esp), %eax
14
15 /* if(length == 0) : end of list */
16 /* write possible 0 to header */
Jeff Dike4bdf8bc2008-02-04 22:30:44 -080017 mov %eax, STUB_DATA+4
Jeff Dikec5600492005-09-03 15:57:36 -070018 cmpl $0, %eax
19 jz done
Bodo Stroesser07bf7312005-09-03 15:57:50 -070020
21 /* save current pointer */
Jeff Dike4bdf8bc2008-02-04 22:30:44 -080022 mov %esp, STUB_DATA+4
Bodo Stroesser07bf7312005-09-03 15:57:50 -070023
24 /* skip additional data */
25 add %eax, %esp
26
27 /* load syscall-# */
28 pop %eax
29
30 /* load syscall params */
Jeff Dikec5600492005-09-03 15:57:36 -070031 pop %ebx
32 pop %ecx
33 pop %edx
34 pop %esi
35 pop %edi
36 pop %ebp
Bodo Stroesser07bf7312005-09-03 15:57:50 -070037
38 /* execute syscall */
Jeff Dikec5600492005-09-03 15:57:36 -070039 int $0x80
Bodo Stroesser07bf7312005-09-03 15:57:50 -070040
41 /* check return value */
42 pop %ebx
43 cmp %ebx, %eax
44 je again
45
46done:
47 /* save return value */
Jeff Dike4bdf8bc2008-02-04 22:30:44 -080048 mov %eax, STUB_DATA
Bodo Stroesser07bf7312005-09-03 15:57:50 -070049
50 /* stop */
51 int3