Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tsoutsman opened this issue Jan 6, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@tsoutsman
Copy link
Contributor

tsoutsman commented Jan 6, 2023

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.

@phil-opp phil-opp added the bug Something isn't working label Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants