Code: Select all
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspsdk.h>
#include <string.h>
PSP_MODULE_INFO("HWDebugger", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
void debugEnableHW(void)
{
asm(
"mfc0 $t0, $12\n"
"lui $t1, 8\n"
"or $t1, $t1, $t0\n"
"mtc0 $t1, $12\n"
);
}
void exhandler()
{
//print hardware instr and address
}
//Keep our module running
int main_thread(SceSize args, void *argp) {
while(!sceKernelFindModuleByName("sceKernelLibrary"))
sceKernelDelayThread(100000);
sceKernelDelayThread(1000000);
debugEnableHW();
sceKernelRegisterPriorityExceptionHandler(24, 1, exhandler);
while(1)
{
sceKernelDelayThread(20000);
}
return 0;
}
int module_start(SceSize args, void *argp) __attribute__((alias("_start")));
int _start(SceSize args, void *argp)
{
sceKernelCreateThread("dbg_main_thread", main_thread, 100, 0x1000, 0, NULL);
return 0;
}