32static int _is_iop_dbg_installed = 0;
34static void *orig_iop_def_ex_handler = NULL;
35static void *orig_iop_break_ex_handler = NULL;
36static void *orig_iop_dbg_ex_handler = NULL;
38static IOP_ExceptionHandler *iop_exception_handlers[16];
40IOP_ExceptionHandler *iop_dbg_get_handler(
int cause)
42 if((cause < 0) || (cause > 15)) {
return(NULL); }
44 return(iop_exception_handlers[cause]);
47IOP_ExceptionHandler *iop_dbg_set_handler(
int cause, IOP_ExceptionHandler *handler)
49 IOP_ExceptionHandler *old_handler;
52 if((cause < 0) || (cause > 15)) {
return(NULL); }
56 old_handler = iop_exception_handlers[cause];
57 iop_exception_handlers[cause] = handler;
67 int excode = M_IOP_GET_CAUSE_EXCODE(frame->cause);
68 IOP_ExceptionHandler *handler = iop_exception_handlers[excode];
76extern void _iop_dbg_set_bpda(u32 addr, u32 mask, u32 user_mask);
77extern void _iop_dbg_set_bpx(u32 addr, u32 mask, u32 user_mask);
80void iop_dbg_set_bpr(u32 addr, u32 mask, u32 user_mask) { _iop_dbg_set_bpda(addr, mask,
IOP_DCIC_DR | user_mask); }
83void iop_dbg_set_bpw(u32 addr, u32 mask, u32 user_mask) { _iop_dbg_set_bpda(addr, mask,
IOP_DCIC_DW | user_mask); }
86void iop_dbg_set_bpx(u32 addr, u32 mask, u32 user_mask) { _iop_dbg_set_bpx(addr, mask, user_mask); }
88void iop_dbg_clr_bpda(
void)
90 u32 dcic = iop_dbg_get_dcic();
93 iop_dbg_set_dcic(dcic);
96void iop_dbg_clr_bpx(
void)
98 u32 dcic = iop_dbg_get_dcic();
101 iop_dbg_set_dcic(dcic);
104void iop_dbg_clr_bps(
void)
113extern void _iop_ex_def_handler(
void);
114extern void _iop_ex_dbg_handler(
void);
115extern void _iop_ex_break_handler(
void);
117int iop_dbg_install(
void)
122 if(_is_iop_dbg_installed) {
return(-1); }
125 for(i = 0; i < 16; i++)
127 iop_exception_handlers[i] = NULL;
136 orig_iop_def_ex_handler = NULL;
144 orig_iop_def_ex_handler = NULL;
145 orig_iop_break_ex_handler = NULL;
153 orig_iop_def_ex_handler = NULL;
156 orig_iop_break_ex_handler = NULL;
158 orig_iop_dbg_ex_handler = NULL;
162 _is_iop_dbg_installed = 1;
166int iop_dbg_remove(
void)
169 if(!_is_iop_dbg_installed) {
return(-1); }
171 if(orig_iop_def_ex_handler)
174 orig_iop_def_ex_handler = NULL;
177 if(orig_iop_break_ex_handler)
180 orig_iop_break_ex_handler = NULL;
183 if(orig_iop_dbg_ex_handler)
186 orig_iop_dbg_ex_handler = NULL;
189 _is_iop_dbg_installed = 0;
195 if(def_frame_ptr) { *def_frame_ptr = &_iop_ex_def_frame; }
196 if(dbg_frame_ptr) { *dbg_frame_ptr = &_iop_ex_dbg_frame; }
#define IOP_EXCEPTION_HDB
#define _EX_DEF_STACK_SIZE
#define _EX_DBG_STACK_SIZE
static void EnterCritical(u32 *old_state)
static void ExitCritical(u32 old_state)