Documentation ¶
Overview ¶
Package testutil provides common assembly stubs for testing.
Index ¶
- func AddrOfGetpid() uintptr
- func AddrOfHaltLoop() uintptr
- func AddrOfSpinLoop() uintptr
- func AddrOfSyscallLoop() uintptr
- func AddrOfTouch() uintptr
- func AddrOfTwiddleRegsFault() uintptr
- func AddrOfTwiddleRegsSyscall() uintptr
- func AddrOfTwiddleSegments() uintptr
- func CheckTestRegs(regs *arch.Registers, full bool) (err error)
- func CheckTestSegments(regs *arch.Registers) (err error)
- func FloatingPointWorks() bool
- func Getpid()
- func RewindSyscall(regs *arch.Registers)
- func SetTestRegs(regs *arch.Registers)
- func SetTestSegments(regs *arch.Registers)
- func SetTestTarget(regs *arch.Registers, fn uintptr)
- func SetTouchTarget(regs *arch.Registers, target *uintptr)
- type RegisterMismatchError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddrOfGetpid ¶
func AddrOfGetpid() uintptr
AddrOfGetpid returns the address of Getpid.
In Go 1.17+, Go references to assembly functions resolve to an ABIInternal wrapper function rather than the function itself. We must reference from assembly to get the ABI0 (i.e., primary) address.
func AddrOfHaltLoop ¶
func AddrOfHaltLoop() uintptr
AddrOfHaltLoop returns the address of a function that immediately halts and loops.
func AddrOfSpinLoop ¶
func AddrOfSpinLoop() uintptr
AddrOfSpinLoop returns the address of a function that spins on the CPU.
func AddrOfSyscallLoop ¶
func AddrOfSyscallLoop() uintptr
AddrOfSyscallLoop returns the address of a function that executes a syscall and loops.
func AddrOfTouch ¶
func AddrOfTouch() uintptr
AddrOfTouch returns the address of a function that touches the value in the first register.
func AddrOfTwiddleRegsFault ¶
func AddrOfTwiddleRegsFault() uintptr
AddrOfTwiddleRegsFault returns the address of a function that twiddles registers then faults.
func AddrOfTwiddleRegsSyscall ¶
func AddrOfTwiddleRegsSyscall() uintptr
AddrOfTwiddleRegsSyscall returns the address of a function that twiddles registers then executes a syscall.
func AddrOfTwiddleSegments ¶
func AddrOfTwiddleSegments() uintptr
AddrOfTwiddleSegments return the address of a function that reads segments into known registers.
func CheckTestRegs ¶
CheckTestRegs checks that registers were twiddled per TwiddleRegs.
func CheckTestSegments ¶
CheckTestSegments checks that registers were twiddled per TwiddleSegments.
func FloatingPointWorks ¶
func FloatingPointWorks() bool
FloatingPointWorks is a floating point test.
It returns true or false.
func SetTestRegs ¶
SetTestRegs initializes registers to known values.
func SetTestSegments ¶
SetTestSegments initializes segments to known values.
func SetTestTarget ¶
SetTestTarget sets the rip appropriately.
func SetTouchTarget ¶
SetTouchTarget sets rax appropriately.
Types ¶
type RegisterMismatchError ¶
type RegisterMismatchError []string
RegisterMismatchError is used for checking registers.
func (RegisterMismatchError) Error ¶
func (r RegisterMismatchError) Error() string
Error returns a human-readable error.