diff options
Diffstat (limited to 'kernel/kapi/system.cpp')
| -rw-r--r-- | kernel/kapi/system.cpp | 9 |
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 |
