Commit | Line | Data |
---|---|---|
54ae36f2 | 1 | #include "as-layout.h" |
d67b569f JD |
2 | |
3 | .globl syscall_stub | |
276c974a | 4 | .section .__syscall_stub, "ax" |
d67b569f JD |
5 | syscall_stub: |
6 | syscall | |
7 | /* We don't have 64-bit constants, so this constructs the address | |
8 | * we need. | |
9 | */ | |
4bdf8bc4 | 10 | movq $(STUB_DATA >> 32), %rbx |
d67b569f | 11 | salq $32, %rbx |
4bdf8bc4 | 12 | movq $(STUB_DATA & 0xffffffff), %rcx |
d67b569f JD |
13 | or %rcx, %rbx |
14 | movq %rax, (%rbx) | |
15 | int3 | |
c5600490 JD |
16 | |
17 | .globl batch_syscall_stub | |
18 | batch_syscall_stub: | |
4bdf8bc4 | 19 | mov $(STUB_DATA >> 32), %rbx |
07bf731e | 20 | sal $32, %rbx |
4bdf8bc4 | 21 | mov $(STUB_DATA & 0xffffffff), %rax |
07bf731e BS |
22 | or %rax, %rbx |
23 | /* load pointer to first operation */ | |
24 | mov %rbx, %rsp | |
25 | add $0x10, %rsp | |
26 | again: | |
27 | /* load length of additional data */ | |
28 | mov 0x0(%rsp), %rax | |
29 | ||
30 | /* if(length == 0) : end of list */ | |
31 | /* write possible 0 to header */ | |
32 | mov %rax, 8(%rbx) | |
33 | cmp $0, %rax | |
34 | jz done | |
35 | ||
36 | /* save current pointer */ | |
37 | mov %rsp, 8(%rbx) | |
38 | ||
39 | /* skip additional data */ | |
40 | add %rax, %rsp | |
41 | ||
42 | /* load syscall-# */ | |
43 | pop %rax | |
44 | ||
45 | /* load syscall params */ | |
c5600490 JD |
46 | pop %rdi |
47 | pop %rsi | |
48 | pop %rdx | |
49 | pop %r10 | |
50 | pop %r8 | |
51 | pop %r9 | |
07bf731e BS |
52 | |
53 | /* execute syscall */ | |
c5600490 | 54 | syscall |
07bf731e BS |
55 | |
56 | /* check return value */ | |
57 | pop %rcx | |
58 | cmp %rcx, %rax | |
59 | je again | |
60 | ||
61 | done: | |
62 | /* save return value */ | |
c5600490 | 63 | mov %rax, (%rbx) |
07bf731e BS |
64 | |
65 | /* stop */ | |
66 | int3 |