Skip to content

Bootloader marks frames used for bootloader page tables as reserved #318

Open
@tsoutsman

Description

@tsoutsman

When allocating frames to copy the bootloader page table, we allocate them using the default frame allocator meaning the kernel will see those regions as reserved. It also happens when mapping the boot info.

This is wrong, as the kernel should be free to overwrite the bootloader's page tables.

Solution

I think a newtype like so:

pub struct BootloaderLegacyFrameAllocator<'a>(pub &'a mut LegacyFrameAllocator);

with a custom FrameAllocator implementation would be the way to go. e.g. when mapping the boot info in the bootloader's page tables, we would do something like this:

page_tables.bootloader.map_to(
    page,
    frame,
    flags,
    &mut BootloaderLegacyFrameAllocator(&mut frame_allocator),
);

Even then, it's not a pretty solution, as we'd need to rework LegacyFrameAllocator to support allocating frames that will be marked as Usable in the memory map.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions