xref: /openbmc/linux/arch/x86/um/stub_64.S (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
237185b33SAl Viro#include <as-layout.h>
35c48b108SAl Viro
45c48b108SAl Viro.section .__syscall_stub, "ax"
55c48b108SAl Viro	.globl batch_syscall_stub
65c48b108SAl Virobatch_syscall_stub:
71b2411c2SRichard Weinberger	mov	$(STUB_DATA), %rbx
85c48b108SAl Viro	/* load pointer to first operation */
95c48b108SAl Viro	mov	%rbx, %rsp
105c48b108SAl Viro	add	$0x10, %rsp
115c48b108SAl Viroagain:
125c48b108SAl Viro	/* load length of additional data */
135c48b108SAl Viro	mov	0x0(%rsp), %rax
145c48b108SAl Viro
155c48b108SAl Viro	/* if(length == 0) : end of list */
165c48b108SAl Viro	/* write possible 0 to header */
175c48b108SAl Viro	mov	%rax, 8(%rbx)
185c48b108SAl Viro	cmp	$0, %rax
195c48b108SAl Viro	jz	done
205c48b108SAl Viro
215c48b108SAl Viro	/* save current pointer */
225c48b108SAl Viro	mov	%rsp, 8(%rbx)
235c48b108SAl Viro
245c48b108SAl Viro	/* skip additional data */
255c48b108SAl Viro	add	%rax, %rsp
265c48b108SAl Viro
275c48b108SAl Viro	/* load syscall-# */
285c48b108SAl Viro	pop	%rax
295c48b108SAl Viro
305c48b108SAl Viro	/* load syscall params */
315c48b108SAl Viro	pop	%rdi
325c48b108SAl Viro	pop	%rsi
335c48b108SAl Viro	pop	%rdx
345c48b108SAl Viro	pop	%r10
355c48b108SAl Viro 	pop	%r8
365c48b108SAl Viro	pop	%r9
375c48b108SAl Viro
385c48b108SAl Viro	/* execute syscall */
395c48b108SAl Viro	syscall
405c48b108SAl Viro
415c48b108SAl Viro	/* check return value */
425c48b108SAl Viro	pop	%rcx
435c48b108SAl Viro	cmp	%rcx, %rax
445c48b108SAl Viro	je	again
455c48b108SAl Viro
465c48b108SAl Virodone:
475c48b108SAl Viro	/* save return value */
485c48b108SAl Viro	mov	%rax, (%rbx)
495c48b108SAl Viro
505c48b108SAl Viro	/* stop */
515c48b108SAl Viro	int3
52