raw_syscall_helper_32.S 864 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .global sys32_helper
  2. sys32_helper:
  3. /* Args: syscall_args_32*, function pointer */
  4. pushl %ebp
  5. pushl %ebx
  6. pushl %esi
  7. pushl %edi
  8. movl 5*4(%esp), %eax /* pointer to args struct */
  9. movl 1*4(%eax), %ebx
  10. movl 2*4(%eax), %ecx
  11. movl 3*4(%eax), %edx
  12. movl 4*4(%eax), %esi
  13. movl 5*4(%eax), %edi
  14. movl 6*4(%eax), %ebp
  15. movl 0*4(%eax), %eax
  16. call *(6*4)(%esp) /* Do the syscall */
  17. /* Now we need to recover without losing any reg values */
  18. pushl %eax
  19. movl 6*4(%esp), %eax
  20. popl 0*4(%eax)
  21. movl %ebx, 1*4(%eax)
  22. movl %ecx, 2*4(%eax)
  23. movl %edx, 3*4(%eax)
  24. movl %esi, 4*4(%eax)
  25. movl %edi, 5*4(%eax)
  26. movl %ebp, 6*4(%eax)
  27. popl %edi
  28. popl %esi
  29. popl %ebx
  30. popl %ebp
  31. ret
  32. .type sys32_helper, @function
  33. .size sys32_helper, .-sys32_helper
  34. .global int80_and_ret
  35. int80_and_ret:
  36. int $0x80
  37. ret
  38. .type int80_and_ret, @function
  39. .size int80_and_ret, .-int80_and_ret