x86

package
v0.0.0-...-b4fbdbd Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Package x86 allows to generate and mutate x86 machine code.

Index

Constants

This section is empty.

Variables

View Source
var XedDecode func(mode iset.Mode, text []byte) (int, error)

Functions

func Register

func Register(insns []*Insn)

Types

type Insn

type Insn struct {
	Name      string
	Extension string

	Mode   iset.Mode // bitmask of compatible modes
	Priv   bool      // CPL=0
	Pseudo bool      // pseudo instructions can consist of several real instructions

	Opcode      []byte
	Prefix      []byte
	Suffix      []byte
	Modrm       bool
	Mod         int8
	Reg         int8 // -6 - segment register, -8 - control register
	Rm          int8
	Srm         bool // register is embed in the first byte
	NoSibDisp   bool // no SIB/disp even if modrm says otherwise
	Imm         int8 // immediate size, -1 - immediate size, -2 - address size, -3 - operand size
	Imm2        int8
	NoRepPrefix bool
	No66Prefix  bool
	Rexw        int8 // 1 must be set, -1 must not be set
	Mem32       bool // instruction always references 32-bit memory operand, 0x67 is illegal
	Mem16       bool // instruction always references 16-bit memory operand

	Vex        byte
	VexMap     byte
	VexL       int8
	VexNoR     bool
	VexP       int8
	Avx2Gather bool
	// contains filtered or unexported fields
}

func (*Insn) Encode

func (insn *Insn) Encode(cfg *iset.Config, r *rand.Rand) []byte

nolint: gocyclo, nestif, gocognit, funlen

func (*Insn) Info

func (insn *Insn) Info() (string, iset.Mode, bool, bool)

type InsnSet

type InsnSet struct {
	Insns []*Insn
	// contains filtered or unexported fields
}

func (*InsnSet) Decode

func (insnset *InsnSet) Decode(mode iset.Mode, text []byte) (int, error)

Decode decodes instruction length for the given mode. It can have falsely decode incorrect instructions, but should not fail to decode correct instructions. nolint: gocyclo, nestif, gocognit, funlen

func (*InsnSet) DecodeExt

func (insnset *InsnSet) DecodeExt(mode iset.Mode, text []byte) (int, error)

func (*InsnSet) GetInsns

func (insnset *InsnSet) GetInsns(mode iset.Mode, typ iset.Type) []iset.Insn

Directories

Path Synopsis
gen generates instruction tables (ifuzz_types/insns.go) from Intel XED tables.
gen generates instruction tables (ifuzz_types/insns.go) from Intel XED tables.

Jump to

Keyboard shortcuts

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