summaryrefslogtreecommitdiff
path: root/Kernel/Firmware/BIOS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Firmware/BIOS.cpp')
-rw-r--r--Kernel/Firmware/BIOS.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/Kernel/Firmware/BIOS.cpp b/Kernel/Firmware/BIOS.cpp
index 61f40edf22..3cb28bfe64 100644
--- a/Kernel/Firmware/BIOS.cpp
+++ b/Kernel/Firmware/BIOS.cpp
@@ -163,11 +163,10 @@ Memory::MappedROM map_bios()
Memory::MappedROM map_ebda()
{
auto ebda_segment_ptr = Memory::map_typed<u16>(PhysicalAddress(0x40e));
- auto ebda_length_ptr_b0 = Memory::map_typed<u8>(PhysicalAddress(0x413));
- auto ebda_length_ptr_b1 = Memory::map_typed<u8>(PhysicalAddress(0x414));
-
- PhysicalAddress ebda_paddr(*ebda_segment_ptr << 4);
- size_t ebda_size = (*ebda_length_ptr_b1 << 8) | *ebda_length_ptr_b0;
+ PhysicalAddress ebda_paddr(PhysicalAddress(*ebda_segment_ptr).get() << 4);
+ // The EBDA size is stored in the first byte of the EBDA in 1K units
+ size_t ebda_size = *Memory::map_typed<u8>(ebda_paddr);
+ ebda_size *= 1024;
Memory::MappedROM mapping;
mapping.region = MM.allocate_kernel_region(ebda_paddr.page_base(), Memory::page_round_up(ebda_size).release_value_but_fixme_should_propagate_errors(), {}, Memory::Region::Access::Read).release_value();