KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Driver for the SH4's UBC More...
Files | |
file | ubc.h |
User Break Controller Driver. | |
Data Structures | |
struct | ubc_breakpoint_t |
UBC breakpoint structure. More... | |
Typedefs | |
typedef bool(* | ubc_break_func_t) (const ubc_breakpoint_t *bp, const struct irq_context *ctx, void *user_data) |
Breakpoint user callback. | |
Enumerations | |
enum | ubc_address_mask_t { ubc_address_mask_none , ubc_address_mask_10 , ubc_address_mask_12 , ubc_address_mask_16 , ubc_address_mask_20 , ubc_address_mask_all } |
UBC address mask specifier. More... | |
enum | ubc_access_t { ubc_access_either , ubc_access_instruction , ubc_access_operand } |
UBC access condition type specifier. More... | |
enum | ubc_rw_t { ubc_rw_either , ubc_rw_read , ubc_rw_write } |
UBC read/write condition type specifier. More... | |
enum | ubc_size_t { ubc_size_any , ubc_size_8bit , ubc_size_16bit , ubc_size_32bit , ubc_size_64bit } |
UBC size condition type specifier. More... | |
Functions | |
bool | ubc_add_breakpoint (const ubc_breakpoint_t *bp, ubc_break_func_t callback, void *user_data) |
Enables a breakpoint. | |
bool | ubc_remove_breakpoint (const ubc_breakpoint_t *bp) |
Disables a breakpoint. | |
void | ubc_clear_breakpoints (void) |
Disables all active breakpoints. | |
Driver for the SH4's UBC
The SH4's User Break Controller (UBC) is a CPU peripheral which facilitates low-level software debugging. It provides two different channels which can be configured to monitor for certain memory or instruction conditions before generating a user-break interrupt. It provides the foundation for creating software-based debuggers and is the backing driver for the GDB debug stub.
The following break comparison conditions are supported:
typedef bool(* ubc_break_func_t) (const ubc_breakpoint_t *bp, const struct irq_context *ctx, void *user_data) |
Breakpoint user callback.
Typedef for the user function to be invoked upon encountering a breakpoint.
bp | Breakpoint that was encountered |
ctx | Context of the current interrupt |
user_data | User-supplied arbitrary callback data |
true | Remove the breakpoint upon callback completion |
false | Leave the breakpoint active upon callback completion |
enum ubc_access_t |
UBC access condition type specifier.
This value specifies whether to break when the address given by ubc_breakpoint_t::address is used as as an instruction, an operand, or either.
Enumerator | |
---|---|
ubc_access_either | Instruction or operand. |
ubc_access_instruction | Instruction. |
ubc_access_operand | Operand. |
enum ubc_address_mask_t |
UBC address mask specifier.
This value specifies which of the low bits are masked off and not included from ubc_breakpoint_t::address when configuring a breakpoint. By default, address masking is disabled, and the exact address given by ubc_breakpoint_t::address will be matched.
enum ubc_rw_t |
enum ubc_size_t |
UBC size condition type specifier.
This value is used with operand-access breakpoints to further specify the size of the operand access to trigger the break condition. It defaults to breaking on any size.
Enumerator | |
---|---|
ubc_size_any | Any sizes. |
ubc_size_8bit | Byte sizes. |
ubc_size_16bit | Word sizes. |
ubc_size_32bit | Longword sizes. |
ubc_size_64bit | Quadword sizes. |
bool ubc_add_breakpoint | ( | const ubc_breakpoint_t * | bp, |
ubc_break_func_t | callback, | ||
void * | user_data ) |
Enables a breakpoint.
Reserves a channel within the UBC for the given breakpoint.
bp | Configuration details for the breakpoint |
callback | Handler which gets called upon breakpoint condition |
user_data | Optional data to pass back to callback handler |
true | The breakpoint was set successfully |
false | The breakpoint failed to be set due to:
|
void ubc_clear_breakpoints | ( | void | ) |
Disables all active breakpoints.
Removes any breakpoints from the UBC, freeing up all channels.
bool ubc_remove_breakpoint | ( | const ubc_breakpoint_t * | bp | ) |
Disables a breakpoint.
Removes a breakpoint from the UBC, freeing up a channel.
bp | The breakpoint to remove |
true | The breakpoint was successfully removed |
false | The breakpoint was not found |