summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 16:35:51 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 16:35:51 -0500
commit7895aaff402a021a1b04645ca8d251f760e5662e (patch)
treec82da4b33086122568fa4c71a60503d31ae7e55d
parentc5db1cf2292b32cbdd5432305f6d720471ee98e5 (diff)
kernel/amd64: trap: Parse TRAP_PAGEFLT error code
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/arch/amd64/amd64/trap.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index cbcf730..b73048d 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -50,6 +50,20 @@ static const char *trap_type[] = {
static const int TRAP_COUNT = __ARRAY_COUNT(trap_type);
static void
+dbg_errcode(struct trapframe *tf)
+{
+ uint64_t ec = tf->error_code;
+
+ if (tf->trapno == TRAP_PAGEFLT) {
+ kprintf("bits (pwui): %c%c%c%c\n",
+ __TEST(ec, __BIT(0)) ? 'p' : '-',
+ __TEST(ec, __BIT(1)) ? 'w' : '-',
+ __TEST(ec, __BIT(2)) ? 'u' : '-',
+ __TEST(ec, __BIT(4)) ? 'i' : '-');
+ }
+}
+
+static void
trap_print(struct trapframe *tf)
{
if (tf->trapno < TRAP_COUNT) {
@@ -57,6 +71,8 @@ trap_print(struct trapframe *tf)
} else {
kprintf("** Unknown trap %d **\n", tf->trapno);
}
+
+ dbg_errcode(tf);
}
static void