libdragon
Files | Data Structures | Enumerations

Handle hardware-generated exceptions. More...

Files

file  exception.c
 Exception Handler.
 
file  exception.h
 Exception Handler.
 

Data Structures

struct  reg_block_t
 Structure representing a register block. More...
 
struct  exception_t
 Structure representing an exception. More...
 
union  reg_block_t.__unnamed33__
 General purpose registers 1-32. More...
 
struct  reg_block_t.__unnamed33__.__unnamed35__
 

Enumerations

enum  { EXCEPTION_TYPE_UNKNOWN = 0 , EXCEPTION_TYPE_RESET , EXCEPTION_TYPE_CRITICAL , EXCEPTION_TYPE_SYSCALL }
 Exception types. More...
 
enum  exception_code_t {
  EXCEPTION_CODE_INTERRUPT = 0 , EXCEPTION_CODE_TLB_MODIFICATION = 1 , EXCEPTION_CODE_TLB_LOAD_I_MISS = 2 , EXCEPTION_CODE_TLB_STORE_MISS = 3 ,
  EXCEPTION_CODE_LOAD_I_ADDRESS_ERROR = 4 , EXCEPTION_CODE_STORE_ADDRESS_ERROR = 5 , EXCEPTION_CODE_I_BUS_ERROR = 6 , EXCEPTION_CODE_D_BUS_ERROR = 7 ,
  EXCEPTION_CODE_SYS_CALL = 8 , EXCEPTION_CODE_BREAKPOINT = 9 , EXCEPTION_CODE_RESERVED_INSTRUCTION = 10 , EXCEPTION_CODE_COPROCESSOR_UNUSABLE = 11 ,
  EXCEPTION_CODE_ARITHMETIC_OVERFLOW = 12 , EXCEPTION_CODE_TRAP = 13 , EXCEPTION_CODE_FLOATING_POINT = 15 , EXCEPTION_CODE_WATCH = 23
}
 Exception codes.
 

Detailed Description

Handle hardware-generated exceptions.

The exception handler traps exceptions generated by hardware. This could be an invalid instruction or invalid memory access exception or it could be a reset exception. In both cases, a handler registered with register_exception_handler will be passed information regarding the exception type and relevant registers.


Data Structure Documentation

◆ reg_block_t

struct reg_block_t

Structure representing a register block.

DO NOT modify the order unless editing inthandler.S

Data Fields
union reg_block_t.__unnamed33__ __unnamed__ General purpose registers 1-32.
uint64_t hi HI.
uint64_t lo LO.
uint32_t sr SR.
uint32_t cr CR (NOTE: can't modify this from an exception handler)
uint32_t epc represents EPC - COP0 register $14

The coprocessor 0 (system control coprocessor - COP0) register $14 is the return from exception program counter. For asynchronous exceptions it points to the place to continue execution whereas for synchronous (caused by code) exceptions, point to the instruction causing the fault condition, which needs correction in the exception handler. This member is for reading/writing its value.

uint32_t fc31 FC31.
uint64_t fpr[32] Floating point registers 1-32.

◆ exception_t

struct exception_t

Structure representing an exception.

Data Fields
int32_t type Exception type.
See also
EXCEPTION_TYPE_RESET, EXCEPTION_TYPE_CRITICAL
exception_code_t code Underlying exception code.
const char * info String information of exception.
reg_block_t * regs Registers at point of exception.

◆ reg_block_t.__unnamed33__

union reg_block_t.__unnamed33__

General purpose registers 1-32.

Data Fields
uint64_t gpr[32]
struct reg_block_t.__unnamed33__.__unnamed35__ __unnamed__

◆ reg_block_t.__unnamed33__.__unnamed35__

struct reg_block_t.__unnamed33__.__unnamed35__
Data Fields
uint64_t zr
uint64_t at
uint64_t v0
uint64_t v1
uint64_t a0
uint64_t a1
uint64_t a2
uint64_t a3
uint64_t t0
uint64_t t1
uint64_t t2
uint64_t t3
uint64_t t4
uint64_t t5
uint64_t t6
uint64_t t7
uint64_t s0
uint64_t s1
uint64_t s2
uint64_t s3
uint64_t s4
uint64_t s5
uint64_t s6
uint64_t s7
uint64_t t8
uint64_t t9
uint64_t k0
uint64_t k1
uint64_t gp
uint64_t sp
uint64_t fp
uint64_t ra

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Exception types.

Enumerator
EXCEPTION_TYPE_UNKNOWN 

Unknown exception.

EXCEPTION_TYPE_RESET 

Reset exception.

EXCEPTION_TYPE_CRITICAL 

Critical exception.

EXCEPTION_TYPE_SYSCALL 

Syscall exception.