summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-06-29 03:31:42 -0400
committerIan Moffett <ian@osmora.org>2025-06-29 03:31:42 -0400
commit3dba14414e27358e9ae9d756f8c234202f6658e5 (patch)
tree94d520706f57c72c1058787c31a74f3755adebc7
parent059fede30f4b2c32e91a46fd45ededb17469f62e (diff)
kernel/amd64: trap: Wrap regdump into a panic()
- Rename regdump() to trap_fatal() - Use panic() rather than kprintf() Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/arch/amd64/amd64/trap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index 5b26334..c57b5d2 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -96,8 +96,8 @@ pf_code(uint64_t error_code)
kprintf("code=[%s]\n", tab);
}
-static void
-regdump(struct trapframe *tf)
+__dead static void
+trap_fatal(struct trapframe *tf)
{
uintptr_t cr3, cr2 = pf_faultaddr();
@@ -111,11 +111,12 @@ regdump(struct trapframe *tf)
pf_code(tf->error_code);
}
- kprintf(OMIT_TIMESTAMP
+ panic("got fatal trap\n\n"
+ "-- DUMPING PROCESSOR STATE --\n"
"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",
+ "RBP=%p RSP=%p RIP=%p\n\n",
tf->rax, tf->rcx, tf->rdx,
tf->rbx, tf->rsi, tf->rdi,
tf->rflags, cr2, cr3,
@@ -192,6 +193,6 @@ trap_handler(struct trapframe *tf)
return;
}
- regdump(tf);
- panic("fatal trap - halting\n");
+ trap_fatal(tf);
+ __builtin_unreachable();
}