1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

Kernel: Fix unaligned read inside map_ebda()

This commit is contained in:
Jean-Baptiste Boric 2021-03-07 12:36:16 +01:00 committed by Andreas Kling
parent a6f957a36b
commit 32e1354b9b

View file

@ -43,10 +43,11 @@ MappedROM map_bios()
MappedROM map_ebda()
{
auto ebda_segment_ptr = map_typed<u16>(PhysicalAddress(0x40e));
auto ebda_length_ptr = map_typed<u16>(PhysicalAddress(0x413));
auto ebda_length_ptr_b0 = map_typed<u8>(PhysicalAddress(0x413));
auto ebda_length_ptr_b1 = map_typed<u8>(PhysicalAddress(0x414));
PhysicalAddress ebda_paddr(*ebda_segment_ptr << 4);
size_t ebda_size = *ebda_length_ptr;
size_t ebda_size = (*ebda_length_ptr_b1 << 8) | *ebda_length_ptr_b0;
MappedROM mapping;
mapping.region = MM.allocate_kernel_region(ebda_paddr.page_base(), page_round_up(ebda_size), {}, Region::Access::Read);