machine

package
v0.0.0-...-122d925 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadObjdump

func ReadObjdump(stdout io.Reader) (insts map[string]int64, regs map[string]int64, err error)

ReadObjdump gets the counts of all registers and instructions used in a binary file

func RunObjdump

func RunObjdump(fpath string) (insts map[string]int64, regs map[string]int64, err error)

RunObjdump executes objdump, getting the counts of all registers and instructions used in the specified file

Types

type Arch

type Arch struct {
	Name string
	// contains filtered or unexported fields
}

Arch represents an Architecture, with its instructions and registers

func ReadArch

func ReadArch(tx *bolt.Tx, id []byte) (a *Arch, err error)

ReadArch deserializes an Arch from a BoltDB and retrieves its Buckets

func ReadArchElf

func ReadArchElf(tx *bolt.Tx, mtype elf.Machine) (a *Arch, err error)

ReadArchElf deserializes an Arch by ELF type from a BoltDB and retrieves its Buckets

func (*Arch) AddInst

func (a *Arch) AddInst(iname string, isaID []byte) (err error)

AddInst adds an instruction to an Arch

func (*Arch) AddReg

func (a *Arch) AddReg(rname string, isaID []byte) (err error)

AddReg adds a register to an Arch

func (*Arch) InstToISA

func (a *Arch) InstToISA(iname string) (id []byte, err error)

InstToISA retrieves the ID for an Instruction's ISA

func (*Arch) NInst

func (a *Arch) NInst() int

NInst gets the total number of instructions for an Arch

func (*Arch) NReg

func (a *Arch) NReg() int

NReg gets the total number of registers for an Arch

func (*Arch) Put

func (a *Arch) Put() (err error)

Put serializes an Arch into a BoltDB and creates its Buckets

func (*Arch) RegToISA

func (a *Arch) RegToISA(rname string) (id []byte, err error)

RegToISA retrieves the ID for a Register's ISA

type ArchYml

type ArchYml struct {
	Name   string        `yaml:"name"`
	MTypes []elf.Machine `yaml:"types"`
}

ArchYml is the YAML representation of an Architecture

func ReadArchYml

func ReadArchYml(raw []byte) (ay *ArchYml, err error)

ReadArchYml deserializes an ArchYml from a []byte

func (*ArchYml) ToArch

func (ay *ArchYml) ToArch(tx *bolt.Tx) *Arch

ToArch converts an ArchYml to an Arch and assigns an ID

type ISA

type ISA struct {
	Name        string
	Description string

	Vendor string
	// contains filtered or unexported fields
}

ISA is an Instruction Set Architecture (ISA) for storage in Bolt

func ReadISA

func ReadISA(tx *bolt.Tx, id []byte) (isa *ISA, err error)

ReadISA deserializes an ISA from a BoltDB

func (*ISA) Put

func (i *ISA) Put() (err error)

Put saves an ISA to a BoltDB

type ISAYml

type ISAYml struct {
	Name         string   `yaml:"name"`
	Description  string   `yaml:"description"`
	Vendor       string   `yaml:"vendor-specific"`
	Inherits     []string `yaml:"inherits"`
	Registers    []string `yaml:"registers"`
	Instructions []string `yaml:"instructions"`
}

ISAYml is a YAML representation of an Instruction Set Architecture (ISA)

func ReadISAYml

func ReadISAYml(raw []byte) (iy *ISAYml, err error)

ReadISAYml deserializes an ArchYml from a []byte

func (*ISAYml) ToISA

func (i *ISAYml) ToISA(tx *bolt.Tx, a *Arch) *ISA

ToISA converts an ISAYml to an ISA

Jump to

Keyboard shortcuts

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