Documentation
¶
Overview ¶
System V AMD64 ABI syscall implementation (Linux, macOS, FreeBSD, etc.) This calling convention is IDENTICAL on all Unix-like systems.
Index ¶
- func CallNFloat(fn uintptr, gpr [6]uintptr, sse [8]float64, stack []uintptr) (r1 uintptr, r2 uintptr, f1 float64, f2 float64)
- func CallNFloatErrno(fn uintptr, gpr [6]uintptr, sse [8]float64, stack []uintptr, errnoFn uintptr) (r1 uintptr, r2 uintptr, f1 float64, f2 float64, cerrno uintptr)
- func ErrnoFnAddr() uintptr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallNFloat ¶ added in v0.4.1
func CallNFloat(fn uintptr, gpr [6]uintptr, sse [8]float64, stack []uintptr) (r1 uintptr, r2 uintptr, f1 float64, f2 float64)
CallNFloat is CallNFloatErrno without errno capture.
func CallNFloatErrno ¶ added in v0.6.0
func CallNFloatErrno(fn uintptr, gpr [6]uintptr, sse [8]float64, stack []uintptr, errnoFn uintptr) (r1 uintptr, r2 uintptr, f1 float64, f2 float64, cerrno uintptr)
CallNFloatErrno calls a C function with 6 integer register arguments, 8 SSE register arguments and len(stack) 8-byte stack words, and captures the C errno value set by the called function.
gpr: RDI, RSI, RDX, RCX, R8, R9 sse: XMM0-XMM7 as float64 bit patterns stack: the stack words in order: stack[0] is at the stack pointer at the call. syscallN reserves exactly this many words on the system stack, so the caller bounds len(stack) (amd64.MaxStackBytes).
The errno function address (errnoFn) must be the address of __errno_location (Linux/FreeBSD) or __error (macOS), obtained from ErrnoFnAddr(). When errnoFn is 0, errno capture is skipped and the returned errno value is always 0. The errno is read inside the assembly trampoline immediately after the C function returns, before the Go runtime can migrate the goroutine to a different OS thread. This is the only safe window for errno capture.
Returns:
- r1: RAX integer return value
- r2: RDX second integer return value (9-16 byte struct returns)
- f1: XMM0 float return value (bit pattern)
- f2: XMM1 second float return value — for {SSE, SSE} 9-16B struct returns (e.g. NSPoint)
func ErrnoFnAddr ¶ added in v0.6.0
func ErrnoFnAddr() uintptr
ErrnoFnAddr returns the address of the platform's errno-location function (__errno_location on glibc Linux, __errno on Bionic, __error on macOS/FreeBSD). This address is passed to CallNFloatErrno to enable in-trampoline errno capture.
Returns 0 if errno capture is not supported on the current platform.
Types ¶
This section is empty.