^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #include <as-layout.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) .section .__syscall_stub, "ax"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) .globl batch_syscall_stub
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) batch_syscall_stub:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) /* load pointer to first operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) mov $(STUB_DATA+8), %esp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) again:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* load length of additional data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) mov 0x0(%esp), %eax
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /* if(length == 0) : end of list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /* write possible 0 to header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) mov %eax, STUB_DATA+4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) cmpl $0, %eax
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) jz done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* save current pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) mov %esp, STUB_DATA+4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* skip additional data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) add %eax, %esp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* load syscall-# */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) pop %eax
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /* load syscall params */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) pop %ebx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) pop %ecx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) pop %edx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) pop %esi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) pop %edi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) pop %ebp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* execute syscall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int $0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* check return value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) pop %ebx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) cmp %ebx, %eax
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) je again
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) done:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /* save return value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) mov %eax, STUB_DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* stop */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int3