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

paging - change initialisation #314

Closed
Orycterope opened this issue Jun 7, 2019 · 0 comments
Closed

paging - change initialisation #314

Orycterope opened this issue Jun 7, 2019 · 0 comments
Assignees
Labels
project-kernel Related to the kernel

Comments

@Orycterope
Copy link
Member

When becoming the first process, we recycle the current page tables hierarchy as our process' page table hierarchy.

When doing so, the kernel treats it as if it was empty, associating an empty bookkeeping with it. However, the bootstrap is still mapped in UserLand at this point.

This creates a situation where the bookkeeping does not reflect the state of the page tables, and leads to a kernel panic as soon as we try to map something in the UserLand of the init process (for me it was its TLS).

There are at least two straight-forward ways to solve this:

  1. Make the bookkeeping reflect the state of the page tables. This means iterating the page tables and reserving any found frame in the FrameAllocator, the same way do for the KernelLand.
  2. Create a fresh ProcessMemory for the init process, and switch to it.

I have a preference for the second method, as it is simpler, even though it is a little bit less efficient.

@Orycterope Orycterope added invalid project-kernel Related to the kernel labels Jun 7, 2019
@Orycterope Orycterope self-assigned this Jun 7, 2019
Orycterope added a commit to Orycterope/SunriseOS that referenced this issue Jun 14, 2019
Second attempt at fixing sunriseos#314.

Compromise between leaking the bootstrap page tables, and reconstructing
full ProcessMemory.

Making InactiveHierarchy public so we can reconstruct one when becoming
the first process, instead of a ProcessMemory.

Deleting ProcessMemory::from_active_page_tables, since we don't use it.

Fixes sunriseos#314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project-kernel Related to the kernel
Projects
None yet
Development

No branches or pull requests

1 participant