models

package
v0.0.0-...-fed3a35 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arch

type Arch struct {
	Name string
	Bits int

	Cpu CpuBuilder

	PC   int
	SP   int
	OS   map[string]*OS
	Regs regMap

	DefaultRegs []string
	// contains filtered or unexported fields
}

func (*Arch) RegDump

func (a *Arch) RegDump(u *cpu.Cpu) ([]RegVal, error)

func (*Arch) RegDumpFast

func (a *Arch) RegDumpFast(c *cpu.Cpu) ([]uint64, error)

FIXME: abstraction hack

func (*Arch) RegEnums

func (a *Arch) RegEnums() []int

func (*Arch) RegNames

func (a *Arch) RegNames() map[int]string

func (*Arch) RegisterOS

func (a *Arch) RegisterOS(os *OS)

func (*Arch) String

func (a *Arch) String() string

type Change

type Change struct {
	Old, New uint64
	Enum     int
	Name     string
}

func NewChange

func NewChange(name string, val, oldVal uint64) *Change

func (*Change) Changed

func (c *Change) Changed() bool

func (*Change) Mask

func (c *Change) Mask(bsz int) []ChangeMask

func (*Change) String

func (c *Change) String(bsz int) string

type ChangeMask

type ChangeMask struct {
	Old, New string
	Changed  bool
}

type Changes

type Changes struct {
	Bsz     int
	Changes []*Change
}

func (*Changes) Changed

func (cs *Changes) Changed() []*Change

func (*Changes) Count

func (cs *Changes) Count() int

func (*Changes) Find

func (cs *Changes) Find(enum int) *Change

func (*Changes) String

func (cs *Changes) String() string

type CpuBuilder

type CpuBuilder interface {
	New() (*cpu.Cpu, error)
}

type ExitStatus

type ExitStatus int

func (ExitStatus) Error

func (e ExitStatus) Error() string

type MapCb

type MapCb func(addr, size uint64, prot int, desc string, file *cpu.FileDesc)

type MapHook

type MapHook struct {
	Map   MapCb
	Unmap UnmapCb
	Prot  ProtCb
}

type OS

type OS struct {
	Name      string
	Kernels   func(Usercorn) []interface{}
	Init      func(Usercorn, []string, []string) error
	Interrupt func(Usercorn, uint32)
}

func (*OS) String

func (o *OS) String() string

type ProtCb

type ProtCb func(addr, size uint64, prot int)

type Reg

type Reg struct {
	Enum    int
	Name    string
	Default bool
}

type RegVal

type RegVal struct {
	Reg
	Val uint64
}

type StatusDiff

type StatusDiff struct {
	U Usercorn
	// contains filtered or unexported fields
}

func (*StatusDiff) Changes

func (s *StatusDiff) Changes(onlyChanged bool) *Changes

type StrucStream

type StrucStream struct {
	Stream  io.ReadWriter
	Options *struc.Options
	Error   error
}

func NewStrucStream

func NewStrucStream(f io.ReadWriter, opts *struc.Options) *StrucStream

func (*StrucStream) Pack

func (s *StrucStream) Pack(vals ...interface{}) error

func (*StrucStream) Sizeof

func (s *StrucStream) Sizeof(vals ...interface{}) (int, error)

func (*StrucStream) Unpack

func (s *StrucStream) Unpack(vals ...interface{}) error

type SysCb

type SysCb func(num int, name string, args []uint64, ret uint64, desc string) bool

type SysGetArgs

type SysGetArgs func(n int) ([]uint64, error)

type SysHook

type SysHook struct {
	Before, After SysCb
}

type Uname

type Uname struct {
	Sysname  string
	Nodename string
	Release  string
	Version  string
	Machine  string
}

func (*Uname) Pad

func (u *Uname) Pad(length int)

type UnmapCb

type UnmapCb func(addr, size uint64)

type Usercorn

type Usercorn interface {
	// CPU
	GetCPU() *cpu.Cpu
	Backend() interface{}
	Mem() io.ReadWriteSeeker
	RegRead(reg int) (uint64, error)
	RegWrite(reg int, val uint64) error
	MemMap(addr, size uint64, prot int) error
	MemProt(addr, size uint64, prot int) error
	MemUnmap(addr, size uint64) error
	MemRegions() ([]*uc.MemRegion, error)
	// end CPU
	//	Task
	Arch() *Arch
	ByteOrder() binary.ByteOrder
	RegDump() ([]RegVal, error)
	Bits() uint
	PackAddr(buf []byte, n uint64) ([]byte, error)
	UnpackAddr(buf []byte) uint64
	PopBytes(p []byte) error
	PushBytes(p []byte) (uint64, error)
	Pop() (uint64, error)
	Push(n uint64) (uint64, error)
	OS() string

	MemReserve(addr, size uint64, force bool) (*cpu.Page, error)
	Mmap(addr, size uint64, prot int, fixed bool, desc string, file *cpu.FileDesc) (uint64, error)
	Malloc(size uint64, desc string) (uint64, error)

	Run() error

	Brk(addr uint64) (uint64, error)
	MapStack(base uint64, size uint64, guard bool) error
	StrucAt(addr uint64) *StrucStream

	Exe() string
	Loader() loader.Loader
	Base() uint64
	Entry() uint64
	BinEntry() uint64
	SetEntry(entry uint64)
	SetExit(exit uint64)

	HookMapAdd(mapCb MapCb, unmapCb UnmapCb, protCb ProtCb) *MapHook
	HookMapDel(cb *MapHook)

	Syscall(num int, name string, getArgs SysGetArgs) (uint64, error)

	Exit(err error)

	Fs() *ramfs.Filesystem
}

Jump to

Keyboard shortcuts

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