1b2441318SGreg 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: 7*9f0b4807SJohannes Berg /* %rsp has the pointer to first operation */ 8*9f0b4807SJohannes Berg mov %rsp, %rbx 95c48b108SAl Viro add $0x10, %rsp 105c48b108SAl Viroagain: 115c48b108SAl Viro /* load length of additional data */ 125c48b108SAl Viro mov 0x0(%rsp), %rax 135c48b108SAl Viro 145c48b108SAl Viro /* if(length == 0) : end of list */ 155c48b108SAl Viro /* write possible 0 to header */ 165c48b108SAl Viro mov %rax, 8(%rbx) 175c48b108SAl Viro cmp $0, %rax 185c48b108SAl Viro jz done 195c48b108SAl Viro 205c48b108SAl Viro /* save current pointer */ 215c48b108SAl Viro mov %rsp, 8(%rbx) 225c48b108SAl Viro 235c48b108SAl Viro /* skip additional data */ 245c48b108SAl Viro add %rax, %rsp 255c48b108SAl Viro 265c48b108SAl Viro /* load syscall-# */ 275c48b108SAl Viro pop %rax 285c48b108SAl Viro 295c48b108SAl Viro /* load syscall params */ 305c48b108SAl Viro pop %rdi 315c48b108SAl Viro pop %rsi 325c48b108SAl Viro pop %rdx 335c48b108SAl Viro pop %r10 345c48b108SAl Viro pop %r8 355c48b108SAl Viro pop %r9 365c48b108SAl Viro 375c48b108SAl Viro /* execute syscall */ 385c48b108SAl Viro syscall 395c48b108SAl Viro 405c48b108SAl Viro /* check return value */ 415c48b108SAl Viro pop %rcx 425c48b108SAl Viro cmp %rcx, %rax 435c48b108SAl Viro je again 445c48b108SAl Viro 455c48b108SAl Virodone: 465c48b108SAl Viro /* save return value */ 475c48b108SAl Viro mov %rax, (%rbx) 485c48b108SAl Viro 495c48b108SAl Viro /* stop */ 505c48b108SAl Viro int3 51