CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
ErrorState Struct Reference

State for error handlers to use. More...

#include <compartment.h>

Public Member Functions

template<CHERI::RegisterNumber ARegisterNumber>
void *& get_register_value ()
 Templated method to get a reference to value of given CHERI::RegisterNumber.
void ** get_register_value (CHERI::RegisterNumber registerNumber)
 Returns a pointer to the value of the given CHERI::RegisterNumber from this ErrorState.

Public Attributes

void * pcc
 The faulting program counter.
void * registers [15]
 The register state where the fault occurred.

Detailed Description

State for error handlers to use.

Note: This structure should have the same layout as the register-save area (that is, the initial sequence of a TrustedStack, up through ca5, inclusive).

Definition at line 20 of file compartment.h.

Member Function Documentation

◆ get_register_value() [1/2]

template<CHERI::RegisterNumber ARegisterNumber>
void *& ErrorState::get_register_value ( )
inlinenodiscard

Templated method to get a reference to value of given CHERI::RegisterNumber.

Static asserts that the register is one of the general purpose ones excluding CZR. This doesn't support getting PCC because in that case you can Use ErrorState.pcc directly.

Definition at line 49 of file compartment.h.

◆ get_register_value() [2/2]

void ** ErrorState::get_register_value ( CHERI::RegisterNumber registerNumber)
inlinenodiscard

Returns a pointer to the value of the given CHERI::RegisterNumber from this ErrorState.

Will either select the appropriate index into ErrorState.registers accounting for the missing CZR, ErrorState.PCC, or if registerNumber is invalid or not contained in ErrorState then nullptr is returned.

Definition at line 66 of file compartment.h.

Member Data Documentation

◆ pcc

void* ErrorState::pcc

The faulting program counter.

Error handlers may modify this but the result must point into the compartment's program counter capability. If it does not then the trusted stack will be unwound forcibly to the caller's compartment.

Note: This is passed as an untagged capability. This allows error handlers to inspect the bounds and permissions, but does not convey the rights.

Definition at line 32 of file compartment.h.

◆ registers

void* ErrorState::registers[15]

The register state where the fault occurred.

These may be modified by an error handler.

Definition at line 38 of file compartment.h.


The documentation for this struct was generated from the following file: