aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi/cpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kapi/cpu.cpp')
-rw-r--r--kernel/kapi/cpu.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/kapi/cpu.cpp b/kernel/kapi/cpu.cpp
new file mode 100644
index 0000000..2089098
--- /dev/null
+++ b/kernel/kapi/cpu.cpp
@@ -0,0 +1,30 @@
+#include "kapi/cpu.hpp"
+
+namespace kapi::cpu
+{
+
+ namespace
+ {
+ struct null_exception_handler : exception_handler
+ {
+ auto handle(exception const &) -> bool override
+ {
+ return false;
+ }
+ } static constinit default_exception_handler;
+
+ exception_handler * current_handler = &default_exception_handler;
+
+ } // namespace
+
+ auto get_exception_handler() -> exception_handler &
+ {
+ return *current_handler;
+ }
+
+ auto set_exception_handler(exception_handler & handler) -> void
+ {
+ current_handler = &handler;
+ }
+
+} // namespace kapi::cpu \ No newline at end of file