aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/trap.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index 85d1058..703b6cf 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -63,6 +63,28 @@ trap_print(struct trapframe *tf)
kprintf(" in %s mode **\n", mode);
}
+static void
+regdump(struct trapframe *tf)
+{
+ uintptr_t cr3, cr2;
+
+ __ASMV("mov %%cr2, %0\n"
+ "mov %%cr3, %1\n"
+ : "=r" (cr2), "=r" (cr3)
+ :
+ : "memory"
+ );
+
+ kprintf("RAX=%p RCX=%p RDX=%p\n"
+ "RBX=%p RSI=%p RDI=%p\n"
+ "RFL=%p CR2=%p CR3=%p\n"
+ "RBP=%p RSP=%p RIP=%p\n",
+ tf->rax, tf->rcx, tf->rdx,
+ tf->rbx, tf->rsi, tf->rdi,
+ tf->rflags, cr2, cr3,
+ tf->rbp, tf->rsp, tf->rip);
+}
+
/*
* Handles traps.
*/
@@ -80,5 +102,6 @@ trap_handler(struct trapframe *tf)
panic("Caught NMI; bailing out\n");
}
- panic("Caught pre-sched exception @0x%x\n", tf->rip);
+ regdump(tf);
+ panic("Caught pre-sched exception\n");
}