From 3412d9ece9942129ce52512149b7156fc1bf97c4 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 17 Sep 2023 11:14:24 -0400 Subject: [PATCH] Add Klog.fatal_error() --- src/hulk/acpi.d | 2 +- src/hulk/klog.d | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/hulk/acpi.d b/src/hulk/acpi.d index 179417b..6d0846b 100644 --- a/src/hulk/acpi.d +++ b/src/hulk/acpi.d @@ -120,7 +120,7 @@ struct Acpi const(XSDT) * xsdt = cast(const(XSDT) *)acpi_xsdt_phys; if (xsdt.header.signature != XSDT_SIGNATURE) { - Klog.writef("XSDT signature invalid\n"); + Klog.fatal_error("XSDT signature invalid"); return; } /* Map the entire XSDT. */ diff --git a/src/hulk/klog.d b/src/hulk/klog.d index 283f0b3..3153ab2 100644 --- a/src/hulk/klog.d +++ b/src/hulk/klog.d @@ -6,6 +6,7 @@ module hulk.klog; import core.stdc.stdarg; import hulk.console; static import hulk.writef; +import hulk.cpu; struct Klog { @@ -70,4 +71,17 @@ struct Klog writef("\n", args); va_end(args); } + + /** + * Print a fatal kernel error and loop forever. + */ + public static void fatal_error(T...)(T args) + { + writef("FATAL ERROR: "); + writefln(args); + cli(); + for (;;) + { + } + } }