[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.
This commit is contained in:
Justin C. Miller
2020-05-21 22:41:33 -07:00
parent 66ca3a3f9b
commit 6ccc172f33
2 changed files with 6 additions and 6 deletions

View File

@@ -63,16 +63,15 @@ uefi_handler::uefi_handler(console &con) :
{ {
} }
[[ noreturn ]] void void
uefi_handler::handle(uefi::status s, const wchar_t *message) uefi_handler::handle(uefi::status s, const wchar_t *message)
{ {
status_line::fail(message, error_message(s)); status_line::fail(message, error_message(s));
while (1) asm("hlt");
} }
cpu_assert_handler::cpu_assert_handler() : handler() {} cpu_assert_handler::cpu_assert_handler() : handler() {}
[[ noreturn ]] void void
cpu_assert_handler::handle(uefi::status s, const wchar_t *message) cpu_assert_handler::handle(uefi::status s, const wchar_t *message)
{ {
asm volatile ( asm volatile (
@@ -83,7 +82,6 @@ cpu_assert_handler::handle(uefi::status s, const wchar_t *message)
: :
: "r"((uint64_t)s) : "r"((uint64_t)s)
: "rax", "rdx", "r8", "r9"); : "rax", "rdx", "r8", "r9");
while (1) asm("hlt");
} }
} // namespace error } // namespace error

View File

@@ -39,7 +39,8 @@ class uefi_handler :
{ {
public: public:
uefi_handler(console &con); 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: private:
console &m_con; console &m_con;
@@ -52,7 +53,8 @@ class cpu_assert_handler :
{ {
public: public:
cpu_assert_handler(); 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 } // namespace error