From 8d06763f47e7b7c93af2a55f6bd2dbc4aa9abfa2 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 26 Mar 2026 16:10:50 +0100 Subject: kapi/cpu: simplify exception handling --- kapi/include/kapi/cpu/exception.hpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'kapi') 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 -- cgit v1.2.3