goarmulator

package module
v0.0.0-...-9ad5c47 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Armulator

type Armulator struct {
	RegistersBank *RegistersBank
	Memory        *mem.Mem
	ELF           *elf.File

	Log *log.Logger
	// contains filtered or unexported fields
}

Armulator is the main structure of this project. It is used to emulate arm programs and run them in a platform idependant way

func NewArmulator

func NewArmulator(elfFile io.ReaderAt) (*Armulator, error)

Creates a new armulator object from an ELF file

func (*Armulator) Close

func (a *Armulator) Close() error

Closes the emulator, thus freeing all resources allocated

func (*Armulator) Run

func (a *Armulator) Run() error

Starts the execution of the program and wait for it to finish. Allocate the memory regions specified in the ELF file, set PC to the entrypoint and start execution.

func (*Armulator) Start

func (a *Armulator) Start() error

Starts the execution of the program. Allocate the memory regions specified in the ELF file, set PC to the entrypoint and start execution.

func (*Armulator) StartContext

func (a *Armulator) StartContext(ctx context.Context) error

Starts the execution of the program with a context. Allocate the memory regions specified in the ELF file, set PC to the entrypoint and start execution.

func (*Armulator) Wait

func (a *Armulator) Wait()

Wait for the execution of the program to finish.

type RegistersBank

type RegistersBank struct {
	// contains filtered or unexported fields
}

Interface for interacting with registers Aarch64 defines 31 general-purpose registers (W0..W30), SP register and PC. Each register can be accessed as X (64bit), or W (32bit, lsb).

func NewAarch64RegistersBank

func NewAarch64RegistersBank() *RegistersBank

func (*RegistersBank) PC

func (b *RegistersBank) PC() uint64

Access the PC register

func (*RegistersBank) SP

func (b *RegistersBank) SP() uint64

Access the SP register

func (*RegistersBank) W

func (b *RegistersBank) W(id int) (uint32, error)

Access W register. Returns error if invalid register was provided

func (*RegistersBank) X

func (b *RegistersBank) X(id int) (uint64, error)

Access X register. Returns error if invalid register was provided

Directories

Path Synopsis
cmd
mem

Jump to

Keyboard shortcuts

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