Re-add functionality to boot with new UEFI headers

- Pointer fixup event
- ACPI searching
- Move CHECK_* to using try_or_raise()
This commit is contained in:
Justin C. Miller
2020-02-22 14:57:28 -08:00
parent 521c132801
commit f627ea7de0
10 changed files with 220 additions and 190 deletions

View File

@@ -6,6 +6,34 @@ namespace error {
handler *handler::s_current = nullptr;
struct error_code_desc {
uefi::status code;
const wchar_t *name;
};
struct error_code_desc error_table[] = {
#define STATUS_ERROR(name, num) { uefi::status::name, L#name },
#define STATUS_WARNING(name, num) { uefi::status::name, L#name },
#include "uefi/errors.inc"
#undef STATUS_ERROR
#undef STATUS_WARNING
{ uefi::status::success, nullptr }
};
static const wchar_t *
error_message(uefi::status status)
{
int32_t i = -1;
while (error_table[++i].name != nullptr) {
if (error_table[i].code == status) return error_table[i].name;
}
if (uefi::is_error(status))
return L"Unknown Error";
else
return L"Unknown Warning";
}
[[ noreturn ]] void
raise(uefi::status status, const wchar_t *message)
{
@@ -38,7 +66,7 @@ uefi_handler::uefi_handler(console &con) :
[[ noreturn ]] void
uefi_handler::handle(uefi::status s, const wchar_t *message)
{
m_con.status_fail(message);
m_con.status_fail(message, error_message(s));
while (1) asm("hlt");
}