iset

package
v0.0.0-...-3b79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Overview

Package iset ("instruction set") provides base and helper types for ifuzz arch implementations.

Index

Constants

View Source
const (
	ArchX86     = "x86"
	ArchPowerPC = "powerpc"
	ArchArm64   = "arm64"
)

Variables

View Source
var Arches = make(map[string]InsnSet)
View Source
var SpecialNumbers = [...]uint64{0, 1 << 15, 1 << 16, 1 << 31, 1 << 32, 1 << 47, 1 << 47, 1 << 63}

Functions

func GenerateInt

func GenerateInt(cfg *Config, r *rand.Rand, size int) uint64

Types

type Config

type Config struct {
	Arch       string
	Len        int         // number of instructions to generate
	Mode       Mode        // one of ModeXXX
	Priv       bool        // generate CPL=0 instructions (x86), HV/!PR mode (PPC)
	Exec       bool        // generate instructions sequences interesting for execution
	MemRegions []MemRegion // generated instructions will reference these regions
}

func (*Config) IsCompatible

func (cfg *Config) IsCompatible(insn Insn) bool

type Insn

type Insn interface {
	Info() (name string, mode Mode, pseudo, priv bool)
	Encode(cfg *Config, r *rand.Rand) []byte
}

type InsnSet

type InsnSet interface {
	GetInsns(mode Mode, typ Type) []Insn
	Decode(mode Mode, text []byte) (int, error)
	DecodeExt(mode Mode, text []byte) (int, error) // XED, to keep ifuzz_test happy
}

type MemRegion

type MemRegion struct {
	Start uint64
	Size  uint64
}

type Mode

type Mode uint
const (
	ModeLong64 Mode = iota
	ModeProt32
	ModeProt16
	ModeReal16
	ModeLast
)

type ModeInsns

type ModeInsns [ModeLast][TypeLast][]Insn

func (*ModeInsns) Add

func (modeInsns *ModeInsns) Add(insn Insn)

type Type

type Type uint
const (
	TypeExec Type = iota
	TypePriv
	TypeUser
	TypeAll
	TypeLast
)

Jump to

Keyboard shortcuts

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