aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-13 12:00:39 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-13 12:00:39 +0200
commit48b95e0b46e32f35ea6f16f41ab99286856292bf (patch)
tree63360b4044913ad2ffd75834e6cd4aec0b8dc0bc /kernel/kapi
parent9f6b1af8b27d73db12025645aa54f78e352cd77c (diff)
downloadkernel-48b95e0b46e32f35ea6f16f41ab99286856292bf.tar.xz
kernel-48b95e0b46e32f35ea6f16f41ab99286856292bf.zip
kapi: extend panic formatting
Diffstat (limited to 'kernel/kapi')
-rw-r--r--kernel/kapi/system.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/kapi/system.cpp b/kernel/kapi/system.cpp
index 86c99515..23dadd3a 100644
--- a/kernel/kapi/system.cpp
+++ b/kernel/kapi/system.cpp
@@ -3,6 +3,7 @@
#include <kapi/cpu.hpp>
#include <kstd/print.hpp>
+#include <kstd/system_error.hpp>
#include <source_location>
#include <string_view>
@@ -18,4 +19,12 @@ namespace kapi::system
cpu::halt();
}
+ [[gnu::weak]]
+ auto panic(std::string_view message, kstd::error_code error, std::source_location location) -> void
+ {
+ kstd::println(kstd::print_sink::stderr, "[PANIC] in {} : {} ({}:{}) @ {}:{}", location.function_name(), message,
+ error.category().name(), error.message(), location.file_name(), location.line());
+ cpu::halt();
+ }
+
} // namespace kapi::system