Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
37185b33 | 2 | #include <as-layout.h> |
d67b569f | 3 | |
276c974a | 4 | .section .__syscall_stub, "ax" |
c5600490 JD |
5 | .globl batch_syscall_stub |
6 | batch_syscall_stub: | |
9f0b4807 JB |
7 | /* %rsp has the pointer to first operation */ |
8 | mov %rsp, %rbx | |
07bf731e BS |
9 | add $0x10, %rsp |
10 | again: | |
11 | /* load length of additional data */ | |
12 | mov 0x0(%rsp), %rax | |
13 | ||
14 | /* if(length == 0) : end of list */ | |
15 | /* write possible 0 to header */ | |
16 | mov %rax, 8(%rbx) | |
17 | cmp $0, %rax | |
18 | jz done | |
19 | ||
20 | /* save current pointer */ | |
21 | mov %rsp, 8(%rbx) | |
22 | ||
23 | /* skip additional data */ | |
24 | add %rax, %rsp | |
25 | ||
26 | /* load syscall-# */ | |
27 | pop %rax | |
28 | ||
29 | /* load syscall params */ | |
c5600490 JD |
30 | pop %rdi |
31 | pop %rsi | |
32 | pop %rdx | |
33 | pop %r10 | |
34 | pop %r8 | |
35 | pop %r9 | |
07bf731e BS |
36 | |
37 | /* execute syscall */ | |
c5600490 | 38 | syscall |
07bf731e BS |
39 | |
40 | /* check return value */ | |
41 | pop %rcx | |
42 | cmp %rcx, %rax | |
43 | je again | |
44 | ||
45 | done: | |
46 | /* save return value */ | |
c5600490 | 47 | mov %rax, (%rbx) |
07bf731e BS |
48 | |
49 | /* stop */ | |
50 | int3 |