stub.S 808 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "uml-config.h"
  2. .globl syscall_stub
  3. .section .__syscall_stub, "x"
  4. .globl batch_syscall_stub
  5. batch_syscall_stub:
  6. /* load pointer to first operation */
  7. mov $(UML_CONFIG_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, UML_CONFIG_STUB_DATA+4
  14. cmpl $0, %eax
  15. jz done
  16. /* save current pointer */
  17. mov %esp, UML_CONFIG_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, UML_CONFIG_STUB_DATA
  38. /* stop */
  39. int3