stub_64.S 779 B

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