stub.S 665 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "uml-config.h"
  2. .globl syscall_stub
  3. .section .__syscall_stub, "x"
  4. syscall_stub:
  5. syscall
  6. /* We don't have 64-bit constants, so this constructs the address
  7. * we need.
  8. */
  9. movq $(UML_CONFIG_STUB_DATA >> 32), %rbx
  10. salq $32, %rbx
  11. movq $(UML_CONFIG_STUB_DATA & 0xffffffff), %rcx
  12. or %rcx, %rbx
  13. movq %rax, (%rbx)
  14. int3
  15. .globl batch_syscall_stub
  16. batch_syscall_stub:
  17. movq $(UML_CONFIG_STUB_DATA >> 32), %rbx
  18. salq $32, %rbx
  19. movq $(UML_CONFIG_STUB_DATA & 0xffffffff), %rcx
  20. or %rcx, %rbx
  21. movq %rbx, %rsp
  22. again: pop %rax
  23. cmpq $0, %rax
  24. jz done
  25. pop %rdi
  26. pop %rsi
  27. pop %rdx
  28. pop %r10
  29. pop %r8
  30. pop %r9
  31. syscall
  32. mov %rax, (%rbx)
  33. jmp again
  34. done: int3