summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-08-15 15:52:54 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-08-15 15:52:54 +0000
commit63212628543e4f7e6b2e7a30c8c815231d1d3140 (patch)
treea4faf3ae046d56019332ffad4fb22a8b5d1c4f74 /firmware/target/mips/ingenic_jz47xx/system-jz4740.c
parent57c0b6a4740d7a900dff7ff0230da1c7942a46b0 (diff)
downloadrockbox-63212628543e4f7e6b2e7a30c8c815231d1d3140.tar.gz
rockbox-63212628543e4f7e6b2e7a30c8c815231d1d3140.tar.bz2
rockbox-63212628543e4f7e6b2e7a30c8c815231d1d3140.zip
Jz4740: get exception handling working
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18287 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/system-jz4740.c')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/system-jz4740.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
index e878173abd..25b14106c4 100644
--- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
@@ -345,9 +345,36 @@ void intr_handler(void)
return;
}
+#define EXC(x,y) if(_cause == (x)) return (y);
+static char* parse_exception(unsigned int cause)
+{
+ unsigned int _cause = cause & M_CauseExcCode;
+ EXC(EXC_INT, "Interrupt");
+ EXC(EXC_MOD, "TLB Modified");
+ EXC(EXC_TLBL, "TLB Exception (Load or Ifetch)");
+ EXC(EXC_ADEL, "Address Error (Load or Ifetch)");
+ EXC(EXC_ADES, "Address Error (Store)");
+ EXC(EXC_TLBS, "TLB Exception (Store)");
+ EXC(EXC_IBE, "Instruction Bus Error");
+ EXC(EXC_DBE, "Data Bus Error");
+ EXC(EXC_SYS, "Syscall");
+ EXC(EXC_BP, "Breakpoint");
+ EXC(EXC_RI, "Reserved Instruction");
+ EXC(EXC_CPU, "Coprocessor Unusable");
+ EXC(EXC_OV, "Overflow");
+ EXC(EXC_TR, "Trap Instruction");
+ EXC(EXC_FPE, "Floating Point Exception");
+ EXC(EXC_C2E, "COP2 Exception");
+ EXC(EXC_MDMX, "MDMX Exception");
+ EXC(EXC_WATCH, "Watch Exception");
+ EXC(EXC_MCHECK, "Machine Check Exception");
+ EXC(EXC_CacheErr, "Cache error caused re-entry to Debug Mode");
+ return NULL;
+}
+
void exception_handler(void* stack_ptr, unsigned int cause, unsigned int epc)
{
- panicf("Exception occurred: [0x%x] at 0x%x (stack at 0x%x)", cause, epc, (unsigned int)stack_ptr);
+ panicf("Exception occurred: %s [0x%08x] at 0x%08x (stack at 0x%08x)", parse_exception(cause), cause, epc, (unsigned int)stack_ptr);
}
static const int FR2n[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
@@ -559,9 +586,8 @@ void system_main(void)
__dcache_writeback_all();
__icache_invalidate_all();
- /* Init interrupt handling */
- ipl = 0;
- for(i=0;i<IRQ_MAX;i++)
+ /* Disable all interrupts */
+ for(i=0; i<IRQ_MAX; i++)
dis_irq(i);
sti();