syscall_linux_386.s 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2009 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // This code is a duplicate of syscall/syscall_linux_386.s with small
  5. // modifications.
  6. #define SYS_SOCKETCALL 102 // from zsysnum_linux_386.go
  7. // func socketcallnosplit7(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
  8. // Kernel interface gets call sub-number and pointer to a0 for Go 1.1.
  9. TEXT ·socketcallnosplit7(SB),7,$0
  10. CALL runtime·entersyscall(SB)
  11. MOVL $SYS_SOCKETCALL, AX // syscall entry
  12. MOVL 4(SP), BX // socket call number
  13. LEAL 8(SP), CX // pointer to call arguments
  14. MOVL $0, DX
  15. MOVL $0, SI
  16. MOVL $0, DI
  17. CALL *runtime·_vdso(SB)
  18. CMPL AX, $0xfffff001
  19. JLS ok1
  20. MOVL $-1, 32(SP) // n
  21. NEGL AX
  22. MOVL AX, 36(SP) // errno
  23. CALL runtime·exitsyscall(SB)
  24. RET
  25. ok1:
  26. MOVL AX, 32(SP) // n
  27. MOVL $0, 36(SP) // errno
  28. CALL runtime·exitsyscall(SB)
  29. RET
  30. // func socketcallnosplit4(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
  31. // Kernel interface gets call sub-number and pointer to a0 for Go 1.2.
  32. TEXT ·socketcallnosplit4(SB),4,$0-40
  33. CALL runtime·entersyscall(SB)
  34. MOVL $SYS_SOCKETCALL, AX // syscall entry
  35. MOVL 4(SP), BX // socket call number
  36. LEAL 8(SP), CX // pointer to call arguments
  37. MOVL $0, DX
  38. MOVL $0, SI
  39. MOVL $0, DI
  40. CALL *runtime·_vdso(SB)
  41. CMPL AX, $0xfffff001
  42. JLS ok2
  43. MOVL $-1, 32(SP) // n
  44. NEGL AX
  45. MOVL AX, 36(SP) // errno
  46. CALL runtime·exitsyscall(SB)
  47. RET
  48. ok2:
  49. MOVL AX, 32(SP) // n
  50. MOVL $0, 36(SP) // errno
  51. CALL runtime·exitsyscall(SB)
  52. RET