testutil

package
v0.0.0-...-f84a013 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package testutil provides common assembly stubs for testing.

Index

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

func CheckTestRegs(regs *arch.Registers, full bool) (err error)

CheckTestRegs checks that registers were twiddled per TwiddleRegs.

func CheckTestSegments

func CheckTestSegments(regs *arch.Registers) (err error)

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 Getpid

func Getpid()

Getpid executes a trivial system call.

func RewindSyscall

func RewindSyscall(regs *arch.Registers)

RewindSyscall rewinds a syscall RIP.

func SetTestRegs

func SetTestRegs(regs *arch.Registers)

SetTestRegs initializes registers to known values.

func SetTestSegments

func SetTestSegments(regs *arch.Registers)

SetTestSegments initializes segments to known values.

func SetTestTarget

func SetTestTarget(regs *arch.Registers, fn uintptr)

SetTestTarget sets the rip appropriately.

func SetTouchTarget

func SetTouchTarget(regs *arch.Registers, target *uintptr)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL