Skip to content

Bootloader incorrectly marks up the memory occupied by itself #468

Closed
@mrjbom

Description

@mrjbom

Trying to figure out why I can't initialize the allocator for ISA DMA memory, I found that I don't have any usable memory in the first 16 MB.

log::info!("Used by kernel: 0x{:x} {}", boot_info.kernel_addr, boot_info.kernel_len);
log::info!("Memory map: {:#x?}", boot_info.memory_regions.iter());

That's what data I get:

Used by kernel: 0x1000000 2865032
...
MemoryRegion {
            start: 0x100000,
            end: 0x12ff000,
            kind: Bootloader,
        }
...

0x12ff000 - 0x100000 = 0x11ff000(18870272)
18 MB from first MB used by bootloader
I doubt that the bootloader has placed so much data in this region. It looks like the memory map is incorrect.

Bootloader on stage 4 contains this memory map

...
E820MemoryRegion {
    start_addr: 0x100000, 
    len: 0x7ee0000, ~128 MB
    region_type: 0x1, Usable
    acpi_extended_attributes: 0x0,
}
...

Bootloader places something incredibly large in this 16 megabytes

I dug into the bootloader's code and found that last_used_addr when initializing LegacyFrameAllocator is 0x12bd000, it seems that even before creating the allocator, the first 18 megabytes are occupied with something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions