added more debugging output for undefined instruction exceptions

This commit is contained in:
bushing 2009-02-28 02:50:33 -08:00
parent baa002b6f1
commit ddc707fceb
2 changed files with 26 additions and 18 deletions

View File

@ -8,7 +8,7 @@
static u8 boot2[256 << 11] MEM2_BSS __attribute__((aligned(64))); static u8 boot2[256 << 11] MEM2_BSS __attribute__((aligned(64)));
static u8 key[32] MEM2_BSS __attribute__((aligned(64))); static u8 key[32] MEM2_BSS __attribute__((aligned(64)));
static u8 ecc[64] __attribute__((aligned(64))); static u8 ecc[128] __attribute__((aligned(64)));
static u8 boot2_initialized = 0; static u8 boot2_initialized = 0;
extern void *vector; extern void *vector;
@ -58,7 +58,6 @@ void boot2_init() {
aes_set_iv(iv); aes_set_iv(iv);
aes_set_key(otp.common_key); aes_set_key(otp.common_key);
memcpy(key, tikptr+0x1bf, 16); memcpy(key, tikptr+0x1bf, 16);
gecko_puts("flushing now...\n");
dc_flushrange(key, 32); dc_flushrange(key, 32);
gecko_puts("dc_flush done.\n"); gecko_puts("dc_flush done.\n");
aes_decrypt(key, key, 1, 0); aes_decrypt(key, key, 1, 0);

View File

@ -6,7 +6,7 @@
#include "memory.h" #include "memory.h"
const char *exceptions[] = { const char *exceptions[] = {
"RESET", "UNDEFINED", "SWI", "INSTR ABORT", "DATA ABORT", "RESERVED", "IRQ", "FIQ" "RESET", "UNDEFINED INSTR", "SWI", "INSTR ABORT", "DATA ABORT", "RESERVED", "IRQ", "FIQ", "(unknown exception type)"
}; };
const char *aborts[] = { const char *aborts[] = {
@ -42,16 +42,17 @@ void exception_initialize(void)
void exc_handler(u32 type, u32 spsr, u32 *regs) void exc_handler(u32 type, u32 spsr, u32 *regs)
{ {
if (type > 8) type = 8;
gecko_printf("\nException %d (%s):\n", type, exceptions[type]); gecko_printf("\nException %d (%s):\n", type, exceptions[type]);
u32 pc; u32 pc, fsr;
switch(type) { switch(type) {
case 3: case 7: // FIQ
case 7: case 3: // INSTR ABORT
pc = regs[15] - 4; pc = regs[15] - 4;
break; break;
case 4: case 4: // DATA ABORT
pc = regs[15] - 8; pc = regs[15] - 8;
break; break;
default: default:
@ -66,12 +67,18 @@ void exc_handler(u32 type, u32 spsr, u32 *regs)
gecko_printf("R12-R15: %08x %08x %08x %08x\n", regs[12], regs[13], regs[14], pc); gecko_printf("R12-R15: %08x %08x %08x %08x\n", regs[12], regs[13], regs[14], pc);
gecko_printf("SPSR: %08x\n", spsr); gecko_printf("SPSR: %08x\n", spsr);
gecko_printf("CPSR: %08x\n", get_cpsr());
gecko_printf("CR: %08x\n", get_cr()); gecko_printf("CR: %08x\n", get_cr());
gecko_printf("TTBR: %08x\n", get_ttbr()); gecko_printf("TTBR: %08x\n", get_ttbr());
gecko_printf("DACR: %08x\n", get_dacr()); gecko_printf("DACR: %08x\n", get_dacr());
if(type == 3 || type == 4) { switch (type) {
u32 fsr; case 1: // undefined instruction
gecko_printf("Undefined instruction @ %08x: %08x\n", regs[14]-4, read32(regs[14]-4));
return;
break;
case 3: // INSTR ABORT
case 4: // DATA ABORT
if(type == 3) if(type == 3)
fsr = get_ifsr(); fsr = get_ifsr();
else else
@ -81,6 +88,8 @@ void exc_handler(u32 type, u32 spsr, u32 *regs)
gecko_printf("Domain: %d\n", (fsr>>4)&0xf); gecko_printf("Domain: %d\n", (fsr>>4)&0xf);
if(type == 4) if(type == 4)
gecko_printf("Address: 0x%08x\n", get_far()); gecko_printf("Address: 0x%08x\n", get_far());
break;
default: break;
} }
panic(0xA3); panic(0xA3);