diff options
author | Tom <tomut@yahoo.com> | 2022-01-02 16:21:12 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-04 17:46:36 +0000 |
commit | e70aa690d2a073c3beb9043c17bb646241f57a60 (patch) | |
tree | c1d7d5e00f1ca579b184dc63c98991146a01ac56 /Kernel/Firmware/BIOS.cpp | |
parent | 84c6d6649e3e0c38d75da87b13c6c38081b7cc70 (diff) | |
download | serenity-e70aa690d2a073c3beb9043c17bb646241f57a60.zip |
Kernel: Fix determining EBDA size
The first byte of the EBDA structure contains the size of the EBDA
in 1 KiB units. We were incorrectly using the word at offset 0x413
of the BDA which specifies the number of KiB before the EBDA structure.
Diffstat (limited to 'Kernel/Firmware/BIOS.cpp')
-rw-r--r-- | Kernel/Firmware/BIOS.cpp | 9 |
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(); |