Al Viro | 37185b3 | 2012-10-08 03:27:32 +0100 | [diff] [blame] | 1 | #include <as-layout.h> |
Jeff Dike | d67b569 | 2005-07-07 17:56:49 -0700 | [diff] [blame] | 2 | |
Amerigo Wang | 276c974 | 2009-06-16 15:33:30 -0700 | [diff] [blame] | 3 | .section .__syscall_stub, "ax" |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 4 | .globl batch_syscall_stub |
| 5 | batch_syscall_stub: |
Richard Weinberger | 1b2411c | 2015-10-26 10:38:27 +0100 | [diff] [blame] | 6 | mov $(STUB_DATA), %rbx |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 7 | /* load pointer to first operation */ |
| 8 | mov %rbx, %rsp |
| 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 */ |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 30 | pop %rdi |
| 31 | pop %rsi |
| 32 | pop %rdx |
| 33 | pop %r10 |
| 34 | pop %r8 |
| 35 | pop %r9 |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 36 | |
| 37 | /* execute syscall */ |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 38 | syscall |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 39 | |
| 40 | /* check return value */ |
| 41 | pop %rcx |
| 42 | cmp %rcx, %rax |
| 43 | je again |
| 44 | |
| 45 | done: |
| 46 | /* save return value */ |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 47 | mov %rax, (%rbx) |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 48 | |
| 49 | /* stop */ |
| 50 | int3 |