syscall_stub.S 492 B

1234567891011121314151617181920
  1. /* int 0x80 syscall stub (ring-3 -> ring-0).
  2. *
  3. * On entry the CPU has pushed SS, ESP, EFLAGS, CS, EIP (from ring-3).
  4. * Registers: eax = syscall number, ebx/ecx/edx = args 1..3.
  5. * The dispatcher's return value is placed in eax before returning to user. */
  6. .code32
  7. .text
  8. .globl syscall_stub
  9. syscall_stub:
  10. pusha
  11. pushl %edx
  12. pushl %ecx
  13. pushl %ebx
  14. pushl %eax
  15. call syscall_dispatch
  16. addl $16, %esp
  17. movl %eax, 28(%esp) /* overwrite the saved eax with the return value */
  18. popa
  19. iret