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 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);
|
||||||
|
41
exception.c
41
exception.c
@ -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,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("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
|
||||||
if(type == 3)
|
gecko_printf("Undefined instruction @ %08x: %08x\n", regs[14]-4, read32(regs[14]-4));
|
||||||
fsr = get_ifsr();
|
return;
|
||||||
else
|
break;
|
||||||
fsr = get_dfsr();
|
case 3: // INSTR ABORT
|
||||||
gecko_printf("Abort type: %s\n", aborts[fsr&0xf]);
|
case 4: // DATA ABORT
|
||||||
if(domvalid[fsr&0xf])
|
if(type == 3)
|
||||||
gecko_printf("Domain: %d\n", (fsr>>4)&0xf);
|
fsr = get_ifsr();
|
||||||
if(type == 4)
|
else
|
||||||
gecko_printf("Address: 0x%08x\n", get_far());
|
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);
|
panic(0xA3);
|
||||||
|
Loading…
Reference in New Issue
Block a user