Page 1 of 1

Paging help

Posted: Thu Jun 30, 2022 4:08 am
by YDeeps1
I am quite new to paging and I am quite confused by it.
Mainly I am wondering what the first steps should be to enabling paging - what should I do?
How should I handle pages during context switches?
Why do both the page directory and entry want a 12 bit address? What are the differences?
I am getting weird undefined behavior after enabling paging and so I assume I need to perform some kind of kernel mapping - how do I make it map to a physical address by default?
Thanks!

Re: Paging help

Posted: Thu Jun 30, 2022 5:54 am
by iansjack
Although written with Rust in mind, rather than C, this article https://os.phil-opp.com/paging-introduction/ gives a good introduction to paging and how it is implemented on x86 processors.

As to your specific question about context switches, each process will have its own page table; when switching processes you update cr3 to point to the appropriate table.