aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi/system.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-14 19:30:03 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-14 19:30:03 +0200
commitd6735726d9cc6e98142e94001250076592279d36 (patch)
tree95d308a027495790af57479cacb064badea334d0 /kernel/kapi/system.cpp
parentcdb8a0928ddfe626a1ac0acd1ae63bc8e5b77355 (diff)
parent9558074af8ceef4dc2c3b168a0263775f8a377e0 (diff)
downloadkernel-d6735726d9cc6e98142e94001250076592279d36.tar.xz
kernel-d6735726d9cc6e98142e94001250076592279d36.zip
Merge branch 'fmorgner/develop/kstd-system-error' into 'develop'
kstd: implement system_error infrastructure See merge request teachos/kernel!54
Diffstat (limited to 'kernel/kapi/system.cpp')
-rw-r--r--kernel/kapi/system.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/kapi/system.cpp b/kernel/kapi/system.cpp
index 9819ceb7..629e5990 100644
--- a/kernel/kapi/system.cpp
+++ b/kernel/kapi/system.cpp
@@ -2,7 +2,8 @@
#include <kapi/cpu.hpp>
-#include <kstd/print>
+#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,
+ location.file_name(), location.line());
+ cpu::halt();
+ }
+
} // namespace kapi::system