libdragon
|
Handle hardware-generated exceptions. More...
Data Structures | |
struct | reg_block_t |
Structure representing a register block. More... | |
struct | exception_t |
Structure representing an exception. More... | |
Files | |
file | exception.c |
Exception Handler. | |
file | exception.h |
Exception Handler. | |
Enumerations | |
enum | { EXCEPTION_TYPE_UNKNOWN = 0, EXCEPTION_TYPE_RESET, EXCEPTION_TYPE_CRITICAL } |
Exception types. More... | |
Functions | |
void | register_exception_handler (void(*cb)(exception_t *)) |
Register an exception handler to handle exceptions. | |
static const char * | __get_exception_name (uint32_t etype) |
Fetch the string name of the exception. | |
static void | __fetch_regs (exception_t *e, int32_t type) |
Fetch relevant registers. | |
void | __onCriticalException () |
Respond to a critical exception. | |
void | __onResetException () |
Respond to a reset exception. | |
Variables | |
static void(* | __exception_handler )(exception_t *) = NULL |
Exception handler currently registered with exception system. | |
const unsigned char * | __baseRegAddr |
Base register offset as defined by the interrupt controller. |
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.
anonymous enum |
static void __fetch_regs | ( | exception_t * | e, |
int32_t | type | ||
) | [static] |
Fetch relevant registers.
[out] | e | Pointer to structure describing the exception |
[in] | type | Exception type. Either EXCEPTION_TYPE_CRITICAL or EXCEPTION_TYPE_RESET |
static const char* __get_exception_name | ( | uint32_t | etype | ) | [static] |
Fetch the string name of the exception.
[in] | etype | Exception type |
void register_exception_handler | ( | void(*)(exception_t *) | cb | ) |
Register an exception handler to handle exceptions.
[in] | cb | Callback function to call when exceptions happen |