stub_32.S 918 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. /* %esp comes in as "top of page" */
  7. mov %esp, %ecx
  8. /* %esp has pointer to first operation */
  9. add $8, %esp
  10. again:
  11. /* load length of additional data */
  12. mov 0x0(%esp), %eax
  13. /* if(length == 0) : end of list */
  14. /* write possible 0 to header */
  15. mov %eax, 0x4(%ecx)
  16. cmpl $0, %eax
  17. jz done
  18. /* save current pointer */
  19. mov %esp, 0x4(%ecx)
  20. /* skip additional data */
  21. add %eax, %esp
  22. /* load syscall-# */
  23. pop %eax
  24. /* load syscall params */
  25. pop %ebx
  26. pop %ecx
  27. pop %edx
  28. pop %esi
  29. pop %edi
  30. pop %ebp
  31. /* execute syscall */
  32. int $0x80
  33. /* restore top of page pointer in %ecx */
  34. mov %esp, %ecx
  35. andl $(~UM_KERN_PAGE_SIZE) + 1, %ecx
  36. /* check return value */
  37. pop %ebx
  38. cmp %ebx, %eax
  39. je again
  40. done:
  41. /* save return value */
  42. mov %eax, (%ecx)
  43. /* stop */
  44. int3