1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-22 20:06:40 +00:00

Fix exception handlers (thanks @fincs)

This commit is contained in:
TuxSH 2018-05-21 03:39:18 +02:00
parent 43d1816ac2
commit ea2693dd2d
2 changed files with 10 additions and 9 deletions

View file

@ -37,10 +37,11 @@ void exception_handler_main(uint32_t *registers, unsigned int exception_type) {
uint32_t instr_addr = pc + ((cpsr & 0x20) ? 2 : 4) - CODE_DUMP_SIZE;
code_dump_size =0;// safecpy(code_dump, (const void *)instr_addr, CODE_DUMP_SIZE);
stack_dump_size = safecpy(stack_dump, (const void *)registers[14], STACK_DUMP_SIZE);
printk("Something went wrong...\n");
code_dump_size = safecpy(code_dump, (const void *)instr_addr, CODE_DUMP_SIZE);
stack_dump_size = safecpy(stack_dump, (const void *)registers[13], STACK_DUMP_SIZE);
printk("\nException type: %s\n", exception_names[exception_type]);
printk("\nRegisters:\n\n");
@ -55,6 +56,7 @@ void exception_handler_main(uint32_t *registers, unsigned int exception_type) {
printk("\nCode dump:\n");
hexdump(code_dump, code_dump_size, instr_addr);
printk("\nStack dump:\n");
hexdump(stack_dump, stack_dump_size, registers[14]);
hexdump(stack_dump, stack_dump_size, registers[13]);
printk("\n");
fatal_error("An exception occured!\n");
}

View file

@ -55,12 +55,10 @@ _exception_handler_data_abort:
/* Mask interrupts (abort mode). */
msr cpsr_cx, #0xD7
adr sp, safecpy
add sp, sp, #8
adr sp, safecpy+8
cmp lr, sp
blo _exception_handler_data_abort_normal
adr sp, _safecpy_end
add sp, sp, #8
adr sp, _safecpy_end+8
cmp lr, sp
bhs _exception_handler_data_abort_normal
@ -87,7 +85,8 @@ safecpy:
_safecpy_loop_end:
mov r0, r3
pop {r4, pc}
pop {r4, lr}
bx lr /* Need to do that separately on ARMv4. */
_safecpy_end: