mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-24 12:19:21 +01:00
added more debugging output for undefined instruction exceptions
This commit is contained in:
parent
baa002b6f1
commit
ddc707fceb
3
boot2.c
3
boot2.c
@ -8,7 +8,7 @@
|
||||
|
||||
static u8 boot2[256 << 11] 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;
|
||||
extern void *vector;
|
||||
|
||||
@ -58,7 +58,6 @@ void boot2_init() {
|
||||
aes_set_iv(iv);
|
||||
aes_set_key(otp.common_key);
|
||||
memcpy(key, tikptr+0x1bf, 16);
|
||||
gecko_puts("flushing now...\n");
|
||||
dc_flushrange(key, 32);
|
||||
gecko_puts("dc_flush done.\n");
|
||||
aes_decrypt(key, key, 1, 0);
|
||||
|
41
exception.c
41
exception.c
@ -6,7 +6,7 @@
|
||||
#include "memory.h"
|
||||
|
||||
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[] = {
|
||||
@ -42,16 +42,17 @@ void exception_initialize(void)
|
||||
|
||||
void exc_handler(u32 type, u32 spsr, u32 *regs)
|
||||
{
|
||||
if (type > 8) type = 8;
|
||||
gecko_printf("\nException %d (%s):\n", type, exceptions[type]);
|
||||
|
||||
u32 pc;
|
||||
u32 pc, fsr;
|
||||
|
||||
switch(type) {
|
||||
case 3:
|
||||
case 7:
|
||||
case 7: // FIQ
|
||||
case 3: // INSTR ABORT
|
||||
pc = regs[15] - 4;
|
||||
break;
|
||||
case 4:
|
||||
case 4: // DATA ABORT
|
||||
pc = regs[15] - 8;
|
||||
break;
|
||||
default:
|
||||
@ -66,21 +67,29 @@ 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("SPSR: %08x\n", spsr);
|
||||
gecko_printf("CPSR: %08x\n", get_cpsr());
|
||||
gecko_printf("CR: %08x\n", get_cr());
|
||||
gecko_printf("TTBR: %08x\n", get_ttbr());
|
||||
gecko_printf("DACR: %08x\n", get_dacr());
|
||||
|
||||
if(type == 3 || type == 4) {
|
||||
u32 fsr;
|
||||
if(type == 3)
|
||||
fsr = get_ifsr();
|
||||
else
|
||||
fsr = get_dfsr();
|
||||
gecko_printf("Abort type: %s\n", aborts[fsr&0xf]);
|
||||
if(domvalid[fsr&0xf])
|
||||
gecko_printf("Domain: %d\n", (fsr>>4)&0xf);
|
||||
if(type == 4)
|
||||
gecko_printf("Address: 0x%08x\n", get_far());
|
||||
switch (type) {
|
||||
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)
|
||||
fsr = get_ifsr();
|
||||
else
|
||||
fsr = get_dfsr();
|
||||
gecko_printf("Abort type: %s\n", aborts[fsr&0xf]);
|
||||
if(domvalid[fsr&0xf])
|
||||
gecko_printf("Domain: %d\n", (fsr>>4)&0xf);
|
||||
if(type == 4)
|
||||
gecko_printf("Address: 0x%08x\n", get_far());
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
panic(0xA3);
|
||||
|
Loading…
Reference in New Issue
Block a user