1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 12:05:07 +00:00

Kernel: Make map_bios() and map_ebda() fallible using ErrorOr

This commit is contained in:
Idan Horowitz 2022-01-13 17:38:09 +02:00 committed by Andreas Kling
parent ae5f5a4d50
commit e2e5d4da16
4 changed files with 48 additions and 21 deletions

View file

@ -86,11 +86,17 @@ UNMAP_AFTER_INIT void MultiProcessorParser::parse_configuration_table()
UNMAP_AFTER_INIT Optional<PhysicalAddress> MultiProcessorParser::find_floating_pointer()
{
StringView signature("_MP_");
auto mp_floating_pointer = map_ebda().find_chunk_starting_with(signature, 16);
if (mp_floating_pointer.has_value())
return mp_floating_pointer;
return map_bios().find_chunk_starting_with(signature, 16);
static constexpr auto signature = "_MP_"sv;
auto ebda_or_error = map_ebda();
if (!ebda_or_error.is_error()) {
auto mp_floating_pointer = ebda_or_error.value().find_chunk_starting_with(signature, 16);
if (mp_floating_pointer.has_value())
return mp_floating_pointer;
}
auto bios_or_error = map_bios();
if (bios_or_error.is_error())
return {};
return bios_or_error.value().find_chunk_starting_with(signature, 16);
}
UNMAP_AFTER_INIT Vector<u8> MultiProcessorParser::get_pci_bus_ids() const