Documentation ¶
Overview ¶
Package value contains the value types used by the replay virtual machine.
Each numerical and boolean value type is backed by a corresponding primitive Go type for convenience of construction and usage. Pointer values can belong to various different address spaces, and for compatibility with both 32 and 64 bit architectures, are all backed by uint64.
Index ¶
- Constants
- Variables
- type AbsolutePointer
- type AbsoluteStackPointer
- type Bool
- type ConstantPointer
- type F32
- type F64
- type ObservedPointer
- type Pointer
- type PointerIndex
- type PointerResolver
- type S16
- type S32
- type S64
- type S8
- type TemporaryPointer
- type U16
- type U32
- type U64
- type U8
- type Value
- type VolatilePointer
Constants ¶
const FirstValidAddress = 0x1001
Anything very low in application address-space is extremely unlikely to be a valid pointer.
Variables ¶
var ValidMemoryRanges = interval.U64RangeList{ interval.U64Range{First: FirstValidAddress, Count: math.MaxUint64 - FirstValidAddress}, }
Functions ¶
This section is empty.
Types ¶
type AbsolutePointer ¶
type AbsolutePointer uint64
AbsolutePointer is a pointer in the absolute address-space that will not be altered before being passed to the protocol.
func (AbsolutePointer) Get ¶
func (p AbsolutePointer) Get(PointerResolver) (ty protocol.Type, val uint64, onStack bool)
Get returns TypeAbsolutePointer and the uint64 value of the absolute pointer.
func (AbsolutePointer) IsValid ¶
func (p AbsolutePointer) IsValid() bool
IsValid returns true for all absolute pointers.
func (AbsolutePointer) Offset ¶
func (p AbsolutePointer) Offset(offset uint64) Pointer
Offset returns the sum of the pointer with offset.
type AbsoluteStackPointer ¶
type AbsoluteStackPointer struct{}
AbsoluteStackPointer represents a pointer on the top of the stack in the absolute address-space that will not be altered before being passed to the protocol.
func (AbsoluteStackPointer) Get ¶
func (p AbsoluteStackPointer) Get(PointerResolver) (ty protocol.Type, val uint64, onStack bool)
Get returns TypeAbsolutePointer and the uint64 value of the absolute pointer.
func (AbsoluteStackPointer) IsValid ¶
func (p AbsoluteStackPointer) IsValid() bool
IsValid returns true for all absolute pointers.
func (AbsoluteStackPointer) Offset ¶
func (p AbsoluteStackPointer) Offset(offset uint64) Pointer
Offset returns the sum of the pointer with offset.
type ConstantPointer ¶
type ConstantPointer uint64
ConstantPointer is a pointer in the constant address-space that will not be altered before being passed to the protocol.
func (ConstantPointer) Get ¶
func (p ConstantPointer) Get(PointerResolver) (ty protocol.Type, val uint64, onStack bool)
Get returns TypeConstantPointer and the uint64 value of the pointer in constant address-space.
func (ConstantPointer) Offset ¶
func (p ConstantPointer) Offset(offset uint64) Pointer
Offset returns the sum of the pointer with offset.
type ObservedPointer ¶
type ObservedPointer uint64
ObservedPointer is a pointer that was observed at capture time. Pointers of this type are remapped to an equivalent volatile address-space pointer, or absolute address-space pointer before being passed to the protocol.
func (ObservedPointer) Get ¶
func (p ObservedPointer) Get(r PointerResolver) (ty protocol.Type, val uint64, onStack bool)
Get returns the pointer type and the pointer translated to either an equivalent volatile address-space pointer or absolute pointer.
func (ObservedPointer) IsValid ¶
func (p ObservedPointer) IsValid() bool
IsValid returns true if the pointer considered valid. Currently this is a test for the pointer being greater than 0x1000 as low addresses are likely to be a wrong interpretation of the value. This may change in the future.
func (ObservedPointer) Offset ¶
func (p ObservedPointer) Offset(offset uint64) Pointer
Offset returns the sum of the pointer with offset.
type Pointer ¶
type Pointer interface { Value // Offset returns the Pointer offset by v. Offset(v uint64) Pointer // IsValid returns true if the pointer is within acceptable ranges. IsValid() bool }
Pointer is a pointer-typed Value.
type PointerIndex ¶
type PointerIndex uint64
PointerIndex is an index to a pointer in the pointer table.
func (PointerIndex) Get ¶
func (p PointerIndex) Get(r PointerResolver) (ty protocol.Type, val uint64, onStack bool)
Get returns TypeVolatilePointer and the volatile address of the pointer.
func (PointerIndex) Offset ¶
func (p PointerIndex) Offset(offset uint64) Pointer
Offset returns the sum of the pointer index with offset.
type PointerResolver ¶
type PointerResolver interface { // ResolveTemporaryPointer returns the temporary address-space pointer ptr // translated to volatile address-space. ResolveTemporaryPointer(TemporaryPointer) VolatilePointer // ResolveObservedPointer returns the pointer translated to volatile or // absolute address-space. ResolveObservedPointer(ObservedPointer) (protocol.Type, uint64) // ResolvePointerIndex returns the pointer to the pointer with the specified // index. ResolvePointerIndex(PointerIndex) (protocol.Type, uint64) }
PointerResolver is used to translate pointers into the volatile address-space.
type TemporaryPointer ¶
type TemporaryPointer uint64
TemporaryPointer is a pointer to in temporary address-space. The temporary address-space sits within a reserved area of the the volatile address space and its offset is calculated dynamically. TODO: REMOVE
func (TemporaryPointer) Get ¶
func (p TemporaryPointer) Get(r PointerResolver) (ty protocol.Type, val uint64, onStack bool)
Get returns TypeVolatilePointer and the dynamically calculated offset of the temporary pointer within volatile address-space.
func (TemporaryPointer) Offset ¶
func (p TemporaryPointer) Offset(offset uint64) Pointer
Offset returns the sum of the pointer with offset.
type Value ¶
type Value interface { // Get returns the protocol type and the bit-representation of the value. // For example a boolean value would either be 0 or 1, a uint32 value would be // zero-extended, a float64 would be the IEEE 754 representation // reinterpreted as a uint64. // If onStack returns true then the value is stored on the top of the VM // stack, and val should be ignored. Get(PointerResolver) (ty protocol.Type, val uint64, onStack bool) }
Value is the interface for all values to be passed either in opcodes or constant memory to the replay virtual machine.
type VolatilePointer ¶
type VolatilePointer uint64
VolatilePointer is a pointer to the volatile address-space. Unlike ObservedPointer, there is no remapping.
func (VolatilePointer) Get ¶
func (p VolatilePointer) Get(PointerResolver) (ty protocol.Type, val uint64, onStack bool)
Get returns TypeVolatilePointer and the uint64 value of the pointer in volatile address-space.
func (VolatilePointer) Offset ¶
func (p VolatilePointer) Offset(offset uint64) Pointer
Offset returns the sum of the pointer with offset.