Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Al Viro | 37185b3 | 2012-10-08 03:27:32 +0100 | [diff] [blame] | 2 | #include <as-layout.h> |
Jeff Dike | d67b569 | 2005-07-07 17:56:49 -0700 | [diff] [blame] | 3 | |
Amerigo Wang | 276c974 | 2009-06-16 15:33:30 -0700 | [diff] [blame] | 4 | .section .__syscall_stub, "ax" |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 5 | .globl batch_syscall_stub |
| 6 | batch_syscall_stub: |
Richard Weinberger | 1b2411c | 2015-10-26 10:38:27 +0100 | [diff] [blame] | 7 | mov $(STUB_DATA), %rbx |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 8 | /* load pointer to first operation */ |
| 9 | mov %rbx, %rsp |
| 10 | add $0x10, %rsp |
| 11 | again: |
| 12 | /* load length of additional data */ |
| 13 | mov 0x0(%rsp), %rax |
| 14 | |
| 15 | /* if(length == 0) : end of list */ |
| 16 | /* write possible 0 to header */ |
| 17 | mov %rax, 8(%rbx) |
| 18 | cmp $0, %rax |
| 19 | jz done |
| 20 | |
| 21 | /* save current pointer */ |
| 22 | mov %rsp, 8(%rbx) |
| 23 | |
| 24 | /* skip additional data */ |
| 25 | add %rax, %rsp |
| 26 | |
| 27 | /* load syscall-# */ |
| 28 | pop %rax |
| 29 | |
| 30 | /* load syscall params */ |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 31 | pop %rdi |
| 32 | pop %rsi |
| 33 | pop %rdx |
| 34 | pop %r10 |
| 35 | pop %r8 |
| 36 | pop %r9 |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 37 | |
| 38 | /* execute syscall */ |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 39 | syscall |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 40 | |
| 41 | /* check return value */ |
| 42 | pop %rcx |
| 43 | cmp %rcx, %rax |
| 44 | je again |
| 45 | |
| 46 | done: |
| 47 | /* save return value */ |
Jeff Dike | c560049 | 2005-09-03 15:57:36 -0700 | [diff] [blame] | 48 | mov %rax, (%rbx) |
Bodo Stroesser | 07bf731 | 2005-09-03 15:57:50 -0700 | [diff] [blame] | 49 | |
| 50 | /* stop */ |
| 51 | int3 |