opcode

package
v0.0.0-...-7a622f3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package opcode holds all the opcodes that are to be interpreted by the replay virtual machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PackAPIIndexFunctionID

func PackAPIIndexFunctionID(index uint8, id uint16) uint32

PackAPIIndexFunctionID packs the API index and the function ID together.

Types

type Add

type Add struct {
	Count uint32 // Number of top value stack elements to pop and sum.
}

Add represents the ADD virtual machine opcode.

func (Add) Encode

func (c Add) Encode(w binary.Writer) error

func (Add) String

func (c Add) String() string

type Call

type Call struct {
	PushReturn bool   // Should the return value be pushed onto the stack?
	ApiIndex   uint8  // The index of the API this call belongs to.
	FunctionID uint16 // The function identifier to call.
}

Call represents the CALL virtual machine opcode.

func (Call) Encode

func (c Call) Encode(w binary.Writer) error

func (Call) String

func (c Call) String() string

type Clone

type Clone struct {
	Index uint32 // Index of element from top of stack to clone.
}

Clone represents the CLONE virtual machine opcode.

func (Clone) Encode

func (c Clone) Encode(w binary.Writer) error

func (Clone) String

func (c Clone) String() string

type Copy

type Copy struct {
	Count uint32 // Number of bytes to copy.
}

Copy represents the COPY virtual machine opcode.

func (Copy) Encode

func (c Copy) Encode(w binary.Writer) error

func (Copy) String

func (c Copy) String() string

type Extend

type Extend struct {
	Value uint32 // 26 bit value to extend the top of the stack by.
}

Extend represents the EXTEND virtual machine opcode.

func (Extend) Encode

func (c Extend) Encode(w binary.Writer) error

func (Extend) String

func (c Extend) String() string

type InlineResource

type InlineResource struct {
	Data            []uint32
	DataSize        uint32
	ValuePatchUps   []InlineResourceValuePatchUp
	PointerPatchUps []InlineResourcePointerPatchUp
	Resolver        value.PointerResolver
	Ctx             context.Context
}

Resource represents the RESOURCE virtual machine opcode.

func DecodeInlineResource

func DecodeInlineResource(opcode uint32, reader binary.Reader) InlineResource

func (InlineResource) Encode

func (c InlineResource) Encode(w binary.Writer) error

func (InlineResource) String

func (c InlineResource) String() string

type InlineResourcePointerPatchUp

type InlineResourcePointerPatchUp struct {
	Destination value.Pointer
	Source      value.Value
}

type InlineResourceValuePatchUp

type InlineResourceValuePatchUp struct {
	Destination value.Pointer
	Value       value.Value
}

type JumpLabel

type JumpLabel struct {
	Label uint32 // 26 bit jump label.
}

JumpLabel represents the JumpLabel virtual machine opcode.

func (JumpLabel) Encode

func (c JumpLabel) Encode(w binary.Writer) error

func (JumpLabel) String

func (c JumpLabel) String() string

type JumpNZ

type JumpNZ struct {
	Label uint32 // 26 bit jump label.
}

JumpNZ represents the JumpNZ virtual machine opcode.

func (JumpNZ) Encode

func (c JumpNZ) Encode(w binary.Writer) error

func (JumpNZ) String

func (c JumpNZ) String() string

type JumpZ

type JumpZ struct {
	Label uint32 // 26 bit jump label.
}

JumpZ represents the JumpZ virtual machine opcode.

func (JumpZ) Encode

func (c JumpZ) Encode(w binary.Writer) error

func (JumpZ) String

func (c JumpZ) String() string

type Label

type Label struct {
	Value uint32 // 26 bit label name.
}

Label represents the LABEL virtual machine opcode.

func (Label) Encode

func (c Label) Encode(w binary.Writer) error

func (Label) String

func (c Label) String() string

type Load

type Load struct {
	DataType protocol.Type // The value types to load.
}

Load represents the LOAD virtual machine opcode.

func (Load) Encode

func (c Load) Encode(w binary.Writer) error

func (Load) String

func (c Load) String() string

type LoadC

type LoadC struct {
	DataType protocol.Type // The value type to load.
	Address  uint32        // The pointer to the value in constant address-space.
}

LoadC represents the LOAD_C virtual machine opcode.

func (LoadC) Encode

func (c LoadC) Encode(w binary.Writer) error

func (LoadC) String

func (c LoadC) String() string

type LoadV

type LoadV struct {
	DataType protocol.Type // The value type to load.
	Address  uint32        // The pointer to the value in volatile address-space.
}

LoadV represents the LOAD_V virtual machine opcode.

func (LoadV) Encode

func (c LoadV) Encode(w binary.Writer) error

func (LoadV) String

func (c LoadV) String() string

type Notification

type Notification struct{}

Notification represents the NOTIFICATION virtual machine opcode.

func (Notification) Encode

func (c Notification) Encode(w binary.Writer) error

func (Notification) String

func (c Notification) String() string

type Opcode

type Opcode interface {
	// contains filtered or unexported methods
}

Opcode represents a single opcode used by GAPIR.

func Decode

func Decode(r binary.Reader) (Opcode, error)

Decode returns the opcode decoded from decoder d.

func Disassemble

func Disassemble(r io.Reader, byteOrder device.Endian) ([]Opcode, error)

Disassemble disassembles and returns the stream of encoded Opcodes from r, stopping once an EOF is reached.

type Pop

type Pop struct {
	Count uint32 // Number of elements to pop from the top of the stack.
}

Pop represents the POP virtual machine opcode.

func (Pop) Encode

func (c Pop) Encode(w binary.Writer) error

func (Pop) String

func (c Pop) String() string

type Post

type Post struct{}

Post represents the POST virtual machine opcode.

func (Post) Encode

func (c Post) Encode(w binary.Writer) error

func (Post) String

func (c Post) String() string

type PushI

type PushI struct {
	DataType protocol.Type // The value type to push.
	Value    uint32        // The value to push packed into the low 20 bits.
}

PushI represents the PUSH_I virtual machine opcode.

func (PushI) Encode

func (c PushI) Encode(w binary.Writer) error

func (PushI) String

func (c PushI) String() string

type Resource

type Resource struct {
	ID uint32 // The index of the resource identifier.
}

Resource represents the RESOURCE virtual machine opcode.

func (Resource) Encode

func (c Resource) Encode(w binary.Writer) error

func (Resource) String

func (c Resource) String() string

type Store

type Store struct{}

Store represents the STORE virtual machine opcode.

func (Store) Encode

func (c Store) Encode(w binary.Writer) error

func (Store) String

func (c Store) String() string

type StoreV

type StoreV struct {
	Address uint32 // Pointer in volatile address-space.
}

StoreV represents the STORE_V virtual machine opcode.

func (StoreV) Encode

func (c StoreV) Encode(w binary.Writer) error

func (StoreV) String

func (c StoreV) String() string

type Strcpy

type Strcpy struct {
	MaxSize uint32 // Maximum size in bytes to copy.
}

Strcpy represents the STRCPY virtual machine opcode.

func (Strcpy) Encode

func (c Strcpy) Encode(w binary.Writer) error

func (Strcpy) String

func (c Strcpy) String() string

type SwitchThread

type SwitchThread struct {
	Index uint32 // 26 bit thread index.
}

SwitchThread represents the SwitchThread virtual machine opcode.

func (SwitchThread) Encode

func (c SwitchThread) Encode(w binary.Writer) error

func (SwitchThread) String

func (c SwitchThread) String() string

type TrivialPointer

type TrivialPointer struct {
	Value uint32
}

func (TrivialPointer) Get

func (t TrivialPointer) Get(value.PointerResolver) (ty protocol.Type, val uint64, onStack bool)

func (TrivialPointer) IsValid

func (t TrivialPointer) IsValid() bool

func (TrivialPointer) Offset

func (t TrivialPointer) Offset(v uint64) value.Pointer

type TrivialPointerResolver

type TrivialPointerResolver struct{}

func (TrivialPointerResolver) ResolveObservedPointer

func (r TrivialPointerResolver) ResolveObservedPointer(value.ObservedPointer) (protocol.Type, uint64)

func (TrivialPointerResolver) ResolvePointerIndex

func (r TrivialPointerResolver) ResolvePointerIndex(value.PointerIndex) (protocol.Type, uint64)

func (TrivialPointerResolver) ResolveTemporaryPointer

type TrivialValue

type TrivialValue struct {
	Value uint32
}

func (TrivialValue) Get

func (t TrivialValue) Get(value.PointerResolver) (ty protocol.Type, val uint64, onStack bool)

type Wait

type Wait struct {
	ID uint32 // 26 bit fence ID.
}

Wait represents the Wait virtual machine opcode.

func (Wait) Encode

func (c Wait) Encode(w binary.Writer) error

func (Wait) String

func (c Wait) String() string

Jump to

Keyboard shortcuts

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