class RegisterState

Defined at line 34 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

Each valid register state (usually one per supported ELF machine spec) must

provide implementations and/or derived implementations in restricted-mode.cc.

This class is a wrapper around zx_restricted_state_t which allows for

target-agnostic interactions with the state data.k

Public Members

static const uint16_t kFpuBufferSize
static const size_t kTlsStorageSize

Protected Members

zx_restricted_state state_
zx_exception_report exception_report_
TlsStorage * tls_

Public Methods

void InitializeRegisters ()

Initializes the register state for a new restricted mode machine.

|tls_storage|: A pointer to the thread-local storage for the machine.

Defined at line 23 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void InitializeFromThreadState (const zx_thread_state_general_regs_t & regs)

Initializes the register state from a thread's general purpose registers.

Defined at line 25 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void RegisterState ()

Default constructor and destructor.

Defined at line 43 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

void ~RegisterState ()

Defined at line 44 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

uintptr_t pc ()

Returns the program counter.

Defined at line 48 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void set_pc (uintptr_t pc)

Sets the program counter.

Defined at line 71 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void set_sp (uintptr_t sp)

Sets the stack pointer.

Defined at line 72 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void set_shadow_sp (uintptr_t sp)

Sets the shadow stack pointer.

Defined at line 73 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void set_arg_regs (uint64_t arg0, uint64_t arg1)

Sets the first two argument registers.

Defined at line 74 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void set_syscall_return (uint64_t value)

Sets the return value when returning from a syscall.

Defined at line 51 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

uint64_t syscall_number ()

Returns the syscall number from the last exit from restricted mode.

Defined at line 49 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void set_syscall_number (uint64_t number)

Sets the register that holds the system call number in restricted mode.

Defined at line 50 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

uintptr_t syscall_arg (unsigned int index)

Returns the value of a syscall argument register.

Defined at line 52 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

bool ArchSupported ()

Returns true if the architecture is supported.

Defined at line 82 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

uint64_t instruction_size ()

Returns the size of an instruction in bytes.

Defined at line 85 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

uint64_t register_bytes ()

Returns the size of a general purpose register in bytes.

Defined at line 88 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

void PrintState (const zx_restricted_state_t & state)

Prints the restricted mode state.

Defined at line 88 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

zx_restricted_state_t & restricted_state ()

Provides access to the underlying zx_restricted_state_t.

Defined at line 100 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

void PrintExceptionState (const zx_restricted_exception_t & exc)

Prints the restricted mode exception state.

Defined at line 102 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

zx_exception_report_t & exception_report ()

Provides access to the underlying zx_exception_report_t.

Defined at line 103 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

TlsStorage * tls ()

Returns a pointer to the thread-local storage.

Defined at line 106 of file ../../src/bringup/lib/restricted-machine/include/bringup/lib/restricted-machine/register-state.h

void PrintExceptionReport (const zx_exception_report_t & report)

Prints an exception report.

Defined at line 107 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc

void set_tls (TlsStorage * tls)

Sets the thread-local storage pointer and updates rhe registers.

Defined at line 79 of file ../../src/bringup/lib/restricted-machine/register-state.x64.cc