50 lines
1.8 KiB
Go
50 lines
1.8 KiB
Go
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build amd64
|
|
|
|
package verify
|
|
|
|
// savedBP holds the caller's frame pointer across the ABI-checked JIT call.
|
|
// Written and read by enterJITChecked/leaveJITChecked (abi_amd64.s); no Go
|
|
// code references it, which GoLand cannot see inside assembly.
|
|
//
|
|
// noinspection GoUnusedGlobalVariable
|
|
//
|
|
//lint:ignore U1000 written and read by the assembly
|
|
var savedBP uintptr
|
|
|
|
// savedR14 holds the caller's goroutine pointer across the ABI-checked JIT
|
|
// call; the trampoline restores it before returning into Go code.
|
|
//
|
|
// noinspection GoUnusedGlobalVariable
|
|
//
|
|
//lint:ignore U1000 written and read by the assembly
|
|
var savedR14 uintptr
|
|
|
|
// leaveCheckedPtr is initialised by the linker from the GLOBL/DATA in
|
|
// abi_amd64.s: it holds the raw address of leaveJITCheckedRaw (which has
|
|
// no ABIInternal wrapper, so the JIT function RETs directly into it).
|
|
var leaveCheckedPtr uintptr
|
|
|
|
// enterJITChecked sets sentinels in BP and R14, switches to the prepared
|
|
// stack and jumps to fn. The body lives in abi_amd64.s and reads the
|
|
// parameters from the frame by name, which GoLand cannot see.
|
|
//
|
|
// noinspection GoUnusedParameter
|
|
//
|
|
//go:nosplit
|
|
func enterJITChecked(fn uintptr, stack uintptr)
|
|
|
|
// leaveJITCheckedRaw is the raw return trampoline for ABI checks. Its
|
|
// address is obtained from the GLOBL in abi_amd64.s (leaveCheckedPtr),
|
|
// which points to the .abi0 code, NOT the ABIInternal wrapper that this
|
|
// declaration would generate. The declaration exists solely to satisfy
|
|
// go vet's "missing Go declaration" check.
|
|
//
|
|
// noinspection GoUnusedFunction
|
|
//
|
|
//lint:ignore U1000 the assembly obtains this address through leaveCheckedPtr
|
|
//go:nosplit
|
|
func leaveJITCheckedRaw()
|