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

Fix higher half kernels by identity mapping context switch fn earlier #161

Merged
merged 3 commits into from
May 14, 2021

Commits on May 14, 2021

  1. Fix higher half kernels by identity mapping context switch fn earlier

    We used to reverve two frames to allow the context switch function to identity-map itself after creating the boot info. This works for kernels that use the standard mapping since they don't need to create new level 3/2 page tables for that. For kernels that are mapped differently (e.g. to the higher half), two frames aren't enough and a frame allocation error occurs. While we could fix this by reserving a larger number of frames, this would result in lost frames for normally-mapped kernels. So we instead do the identity-mapping already in the `set_up_mappings` function, where the normal frame allocator still exists. This way, we no longer need the `TwoFrames` workaaround at all.
    
    To ensure that this all works as intended, this PR also adds a new `higher_half` test kernel that maps itself to address `0xFFFF800000000000` via its custom target. By reading the `rip` register, the test kernel can verify that it was indeed loaded to the higher half.
    phil-opp committed May 14, 2021
    Configuration menu
    Copy the full SHA
    3be235b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d6332e9 View commit details
    Browse the repository at this point in the history
  3. Update changelog

    phil-opp committed May 14, 2021
    Configuration menu
    Copy the full SHA
    277c04e View commit details
    Browse the repository at this point in the history