stub.S 764 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "as-layout.h"
  2. .globl syscall_stub
  3. .section .__syscall_stub, "ax"
  4. .globl batch_syscall_stub
  5. batch_syscall_stub:
  6. /* load pointer to first operation */
  7. mov $(STUB_DATA+8), %esp
  8. again:
  9. /* load length of additional data */
  10. mov 0x0(%esp), %eax
  11. /* if(length == 0) : end of list */
  12. /* write possible 0 to header */
  13. mov %eax, STUB_DATA+4
  14. cmpl $0, %eax
  15. jz done
  16. /* save current pointer */
  17. mov %esp, STUB_DATA+4
  18. /* skip additional data */
  19. add %eax, %esp
  20. /* load syscall-# */
  21. pop %eax
  22. /* load syscall params */
  23. pop %ebx
  24. pop %ecx
  25. pop %edx
  26. pop %esi
  27. pop %edi
  28. pop %ebp
  29. /* execute syscall */
  30. int $0x80
  31. /* check return value */
  32. pop %ebx
  33. cmp %ebx, %eax
  34. je again
  35. done:
  36. /* save return value */
  37. mov %eax, STUB_DATA
  38. /* stop */
  39. int3