[metal] CPU exception handler now dumps cr2 value

This commit is contained in:
tkchia 2022-10-05 16:41:30 +00:00
parent 5aaadf1162
commit b8cd8a07b4

View file

@ -70,9 +70,11 @@ __excep0_isr:
push %rcx # preserve registers which we will push %rcx # preserve registers which we will
push %rdx # use to call kprintf push %rdx # use to call kprintf
push %r8 push %r8
mov 40(%rsp),%rcx # edx:rcx = "caller" cs:rip push %r9
mov 48(%rsp),%edx mov 48(%rsp),%rcx # edx:rcx = "caller" cs:rip
mov 32(%rsp),%r8 # r8 = error code mov 56(%rsp),%edx
mov 40(%rsp),%r8 # r8 = error code
mov %cr2,%r9 # r9 = cr2, in case it is useful
push %rax # preserve other call-used registers push %rax # preserve other call-used registers
push %rdi push %rdi
push %r9 push %r9
@ -141,7 +143,8 @@ isr_init:
// String constants. // String constants.
.rodata.str1.1 .rodata.str1.1
.excep_msg: .excep_msg:
.asciz "CPU exception %d @ %#llx:%#llx err code %#llx\n" .ascii "\033[1;31mCPU exception %d @ %#llx:%#llx err code %#llx "
.asciz "cr2 %#llx\33[0m\n"
.previous .previous
// IDTR value. // IDTR value.