xref: /openbmc/linux/arch/x86/um/stub_64.S (revision 81de3bf3)
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <as-layout.h>
3
4.section .__syscall_stub, "ax"
5	.globl batch_syscall_stub
6batch_syscall_stub:
7	mov	$(STUB_DATA), %rbx
8	/* 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 */
31	pop	%rdi
32	pop	%rsi
33	pop	%rdx
34	pop	%r10
35 	pop	%r8
36	pop	%r9
37
38	/* execute syscall */
39	syscall
40
41	/* check return value */
42	pop	%rcx
43	cmp	%rcx, %rax
44	je	again
45
46done:
47	/* save return value */
48	mov	%rax, (%rbx)
49
50	/* stop */
51	int3
52