amd64: add extra information on fault

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-14 23:34:49 -04:00
commit 70d171fed8
3 changed files with 26 additions and 16 deletions

View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <kernel/common.h>
#include <lib/stdio.h>
#include "arch/reg.h"
static const char *exception_names[] = {
"Divide-by-zero Error",
@ -38,5 +39,8 @@ static const char *exception_names[] = {
void exception_handler(u64 no, u64 err)
{
panic("(Exception) %s(%02xh)\n", exception_names[no], no);
if (no == 0x0e)
kerr("(Page fault): 0x%16x\n", cr2_read());
if (!kernel_init_ready)
panic("(Exception) %s(%02xh)\n", exception_names[no], no);
}