aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-03-26 16:10:50 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-03-27 07:02:35 +0100
commit8d06763f47e7b7c93af2a55f6bd2dbc4aa9abfa2 (patch)
treeb4da8395e2ba5dec565500b6b257a2091faeeb17 /kapi
parentd56700342ea0266a6e49f9515eb83279f66b4fcf (diff)
downloadteachos-8d06763f47e7b7c93af2a55f6bd2dbc4aa9abfa2.tar.xz
teachos-8d06763f47e7b7c93af2a55f6bd2dbc4aa9abfa2.zip
kapi/cpu: simplify exception handling
Diffstat (limited to 'kapi')
-rw-r--r--kapi/include/kapi/cpu/exception.hpp27
1 files changed, 6 insertions, 21 deletions
diff --git a/kapi/include/kapi/cpu/exception.hpp b/kapi/include/kapi/cpu/exception.hpp
index 00b02e7..d6e8511 100644
--- a/kapi/include/kapi/cpu/exception.hpp
+++ b/kapi/include/kapi/cpu/exception.hpp
@@ -31,7 +31,7 @@ namespace kapi::cpu
memory_access_fault,
//! An invalid instruction was present in the instruction stream.
illegal_instruction,
- //! The precoditions for the execution of an instruction were not met.
+ //! The preconditions for the execution of an instruction were not met.
privilege_violation,
//! An arithmetic error occurred.
arithmetic_error,
@@ -60,27 +60,12 @@ namespace kapi::cpu
bool is_user_mode{};
};
- //! The abstract interface for exception handlers.
- //!
- //! The kernel must define an exception handler to be used during execution.
- struct exception_handler
- {
- virtual ~exception_handler() = default;
-
- //! Handle an exception.
- //!
- //! @param context The exception context.
- //! @return Whether the exception was handled.
- virtual auto handle(exception const & context) -> bool = 0;
- };
-
- //! @qualifier kernel-defined
- //! Get the currently active exception handler.
- auto get_exception_handler() -> exception_handler &;
-
//! @qualifier kernel-defined
- //! Set the exception handler.
- auto set_exception_handler(exception_handler & handler) -> void;
+ //! Dispatch an exception to the appropriate handler.
+ //!
+ //! @param context The exception context.
+ //! @return Whether the exception was handled.
+ auto dispatch(exception const & context) -> bool;
} // namespace kapi::cpu