raw_syscall_helper_32.S 903 B

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