From 6ccc172f334d8513ad3a9fb00973e53b12423893 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Thu, 21 May 2020 22:41:33 -0700 Subject: [PATCH] [boot] Centralize where to hlt on error Searching for `hlt` in disassembly is an easy way to find the error handler. This change centralizes it to just one, to better match disassembly with code. --- src/boot/error.cpp | 6 ++---- src/boot/error.h | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/boot/error.cpp b/src/boot/error.cpp index 1f888bb..92d623d 100644 --- a/src/boot/error.cpp +++ b/src/boot/error.cpp @@ -63,16 +63,15 @@ uefi_handler::uefi_handler(console &con) : { } -[[ noreturn ]] void +void uefi_handler::handle(uefi::status s, const wchar_t *message) { status_line::fail(message, error_message(s)); - while (1) asm("hlt"); } cpu_assert_handler::cpu_assert_handler() : handler() {} -[[ noreturn ]] void +void cpu_assert_handler::handle(uefi::status s, const wchar_t *message) { asm volatile ( @@ -83,7 +82,6 @@ cpu_assert_handler::handle(uefi::status s, const wchar_t *message) : : "r"((uint64_t)s) : "rax", "rdx", "r8", "r9"); - while (1) asm("hlt"); } } // namespace error diff --git a/src/boot/error.h b/src/boot/error.h index c5435ef..9df8f21 100644 --- a/src/boot/error.h +++ b/src/boot/error.h @@ -39,7 +39,8 @@ class uefi_handler : { public: uefi_handler(console &con); - [[ noreturn ]] void handle(uefi::status, const wchar_t*) override; + virtual ~uefi_handler() {} + void handle(uefi::status, const wchar_t*) override; private: console &m_con; @@ -52,7 +53,8 @@ class cpu_assert_handler : { public: cpu_assert_handler(); - [[ noreturn ]] void handle(uefi::status, const wchar_t*) override; + virtual ~cpu_assert_handler() {} + void handle(uefi::status, const wchar_t*) override; }; } // namespace error