stub.S 803 B

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