blob: 8a95c5b2eaf93266a64543ae2fa86cfdecff89b0 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Al Viro37185b32012-10-08 03:27:32 +01002#include <as-layout.h>
Jeff Diked67b5692005-07-07 17:56:49 -07003
Amerigo Wang276c9742009-06-16 15:33:30 -07004.section .__syscall_stub, "ax"
Jeff Dikec5600492005-09-03 15:57:36 -07005 .globl batch_syscall_stub
6batch_syscall_stub:
Richard Weinberger1b2411c2015-10-26 10:38:27 +01007 mov $(STUB_DATA), %rbx
Bodo Stroesser07bf7312005-09-03 15:57:50 -07008 /* load pointer to first operation */
9 mov %rbx, %rsp
10 add $0x10, %rsp
11again:
12 /* load length of additional data */
13 mov 0x0(%rsp), %rax
14
15 /* if(length == 0) : end of list */
16 /* write possible 0 to header */
17 mov %rax, 8(%rbx)
18 cmp $0, %rax
19 jz done
20
21 /* save current pointer */
22 mov %rsp, 8(%rbx)
23
24 /* skip additional data */
25 add %rax, %rsp
26
27 /* load syscall-# */
28 pop %rax
29
30 /* load syscall params */
Jeff Dikec5600492005-09-03 15:57:36 -070031 pop %rdi
32 pop %rsi
33 pop %rdx
34 pop %r10
35 pop %r8
36 pop %r9
Bodo Stroesser07bf7312005-09-03 15:57:50 -070037
38 /* execute syscall */
Jeff Dikec5600492005-09-03 15:57:36 -070039 syscall
Bodo Stroesser07bf7312005-09-03 15:57:50 -070040
41 /* check return value */
42 pop %rcx
43 cmp %rcx, %rax
44 je again
45
46done:
47 /* save return value */
Jeff Dikec5600492005-09-03 15:57:36 -070048 mov %rax, (%rbx)
Bodo Stroesser07bf7312005-09-03 15:57:50 -070049
50 /* stop */
51 int3