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

Steps to divide the address space in kernel space and user space #1081

Closed
sauravdeshpande opened this issue Feb 22, 2022 · 2 comments
Closed

Comments

@sauravdeshpande
Copy link

Great blog, I have followed all the articles so far from the blog os post, I was thinking about how to divide the address spaces.
What modifications are needed to divide the virtual memory into kernel space and user space and how context switch can be done.

Thank you

@nullium21
Copy link

Here's an article about how to get to usermode (a.k.a Ring 3 on x86): https://wiki.osdev.org/Getting_to_Ring_3

  • Add two new GDT entries (at least) configured for ring 3.
  • Set up a barebones TSS with an ESP0 stack.
  • Set up an IDT entry for ring 3 system call interrupts (optional).

@phil-opp
Copy link
Owner

phil-opp commented Mar 6, 2022

For moving the kernel to the higher half, it should be enough to instruct the linker to use a different base address. You can do this through a linker script or by passing an --image-base argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants