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, stackArgs [9]uintptr, numStack int) (r1 uintptr, r2 uintptr, f1 float64, f2 float64)
- func CallNFloatErrno(fn uintptr, gpr [6]uintptr, sse [8]float64, stackArgs [9]uintptr, numStack int, ...) (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, stackArgs [9]uintptr, numStack int) (r1 uintptr, r2 uintptr, f1 float64, f2 float64)
CallNFloat calls a C function with up to 6 integer register arguments, 8 SSE arguments, and 9 stack-spill arguments (15 total).
gpr: first 6 GP register values (RDI, RSI, RDX, RCX, R8, R9) sse: 8 SSE register values (XMM0-XMM7) as float64 bit patterns stackArgs: additional arguments to push onto the stack before CALL numStack: how many entries in stackArgs are valid (0-9)
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 CallNFloatErrno ¶ added in v0.6.0
func CallNFloatErrno(fn uintptr, gpr [6]uintptr, sse [8]float64, stackArgs [9]uintptr, numStack int, errnoFn uintptr) (r1 uintptr, r2 uintptr, f1 float64, f2 float64, cerrno uintptr)
CallNFloatErrno is like CallNFloat but also captures the C errno value set by the called function. 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.
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.