mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07:45 +00:00
Kernel: Make map_typed() & map_typed_writable() fallible using ErrorOr
This mostly just moved the problem, as a lot of the callers are not capable of propagating the errors themselves, but it's a step in the right direction.
This commit is contained in:
parent
e2e5d4da16
commit
fb3e46e930
14 changed files with 80 additions and 57 deletions
|
@ -271,7 +271,12 @@ UNMAP_AFTER_INIT bool APIC::init_bsp()
|
|||
}
|
||||
|
||||
if (kernel_command_line().is_smp_enabled()) {
|
||||
auto madt = Memory::map_typed<ACPI::Structures::MADT>(madt_address.value());
|
||||
auto madt_or_error = Memory::map_typed<ACPI::Structures::MADT>(madt_address.value());
|
||||
if (madt_or_error.is_error()) {
|
||||
dbgln("APIC: Failed to map MADT table");
|
||||
return false;
|
||||
}
|
||||
auto madt = madt_or_error.release_value();
|
||||
size_t entry_index = 0;
|
||||
size_t entries_length = madt->h.length - sizeof(ACPI::Structures::MADT);
|
||||
auto* madt_entry = madt->entries;
|
||||
|
|
|
@ -25,7 +25,7 @@ enum DeliveryMode {
|
|||
|
||||
UNMAP_AFTER_INIT IOAPIC::IOAPIC(PhysicalAddress address, u32 gsi_base)
|
||||
: m_address(address)
|
||||
, m_regs(Memory::map_typed_writable<ioapic_mmio_regs>(m_address))
|
||||
, m_regs(Memory::map_typed_writable<ioapic_mmio_regs>(m_address).release_value_but_fixme_should_propagate_errors())
|
||||
, m_gsi_base(gsi_base)
|
||||
, m_id((read_register(0x0) >> 24) & 0xFF)
|
||||
, m_version(read_register(0x1) & 0xFF)
|
||||
|
|
|
@ -189,7 +189,7 @@ UNMAP_AFTER_INIT void InterruptManagement::switch_to_ioapic_mode()
|
|||
UNMAP_AFTER_INIT void InterruptManagement::locate_apic_data()
|
||||
{
|
||||
VERIFY(!m_madt.is_null());
|
||||
auto madt = Memory::map_typed<ACPI::Structures::MADT>(m_madt);
|
||||
auto madt = Memory::map_typed<ACPI::Structures::MADT>(m_madt).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
int irq_controller_count = 0;
|
||||
if (madt->flags & PCAT_COMPAT_FLAG) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue