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