adds some more exception stuff
This commit is contained in:
@ -108,6 +108,16 @@ static void examine_page_fault(uint32_t error_code)
|
|||||||
#undef PF_SS
|
#undef PF_SS
|
||||||
#undef PF_SGX
|
#undef PF_SGX
|
||||||
|
|
||||||
|
static void dump_cpu_state(struct cpu_state cpu, struct stack_state stack)
|
||||||
|
{
|
||||||
|
kinfo("DUMPING CPU STATE");
|
||||||
|
printf("eax: %2\nebx: %2\necx: %2\nedx: %2\nesi: %2\nedi: %22\nebp: %2\n",
|
||||||
|
cpu.eax, cpu.ebx, cpu.ecx, cpu.edx, cpu.esi, cpu.edi, cpu.ebp);
|
||||||
|
kinfo("DUMPING STACK STATE FOR INTERRUPT");
|
||||||
|
printf("eip: %2\ncs: %2\neflags: %2\n",
|
||||||
|
stack.eip, stack.cs, stack.eflags);
|
||||||
|
}
|
||||||
|
|
||||||
#define EXCEPTION_LOCATION() printf("Exception occurred at 0x%2\n", stack.eip)
|
#define EXCEPTION_LOCATION() printf("Exception occurred at 0x%2\n", stack.eip)
|
||||||
|
|
||||||
void exception_handler(struct cpu_state __attribute__((unused)) cpu, uint32_t interrupt, struct stack_state stack)
|
void exception_handler(struct cpu_state __attribute__((unused)) cpu, uint32_t interrupt, struct stack_state stack)
|
||||||
@ -229,6 +239,9 @@ void exception_handler(struct cpu_state __attribute__((unused)) cpu, uint32_t in
|
|||||||
default:
|
default:
|
||||||
kerror("EXCEPTION: UNHANDLED EXCEPTION OR INTERRUPT");
|
kerror("EXCEPTION: UNHANDLED EXCEPTION OR INTERRUPT");
|
||||||
printf("Error code: 0x%2\n", stack.error_code);
|
printf("Error code: 0x%2\n", stack.error_code);
|
||||||
|
dump_cpu_state(cpu, stack);
|
||||||
|
|
||||||
|
// TODO i would love to track spurious interrupts as well, would be useful to dump their state and specify that its spurious (if possible)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user