Understanding the application of paging
Posted: Thu Jul 27, 2023 5:54 am
Hi,
I have to say I'm pretty new to OSDev, so sorry if this is a really simple question. But I am trying to implement paging in my OS, which I have successfully done, or at least I loaded my page directory into the cr3 register without it crashing or throwing a page fault. I basically copied the paging code from the paging tutorial page, which I fully understand what it does other than the 4096 alignment.
I understand that pages are 4kib of memory and that a page table has 1024 pages, totalling 4mib and that we have 1024 page tables in the page directory totalling 4gib. We then load a pointer to the page directory into the cr3 register and enable the paging bit in the cr0 register to enable paging. But the part I'm confused about is actually using paging within my OS. Do I load my kernel into pages? What actually is page frame allocation? is it just allocating pages to locations in memory? and how does paging actually help me with my OS other than sort of sand-boxing programs to their own little address space?
Apologies again if this is simple or stupid, even after reading the OSDev wiki on paging and some of the related pages and even reading the 80386 programmers guide didn't really help me understand the concept.
Thanks in advance.
I have to say I'm pretty new to OSDev, so sorry if this is a really simple question. But I am trying to implement paging in my OS, which I have successfully done, or at least I loaded my page directory into the cr3 register without it crashing or throwing a page fault. I basically copied the paging code from the paging tutorial page, which I fully understand what it does other than the 4096 alignment.
I understand that pages are 4kib of memory and that a page table has 1024 pages, totalling 4mib and that we have 1024 page tables in the page directory totalling 4gib. We then load a pointer to the page directory into the cr3 register and enable the paging bit in the cr0 register to enable paging. But the part I'm confused about is actually using paging within my OS. Do I load my kernel into pages? What actually is page frame allocation? is it just allocating pages to locations in memory? and how does paging actually help me with my OS other than sort of sand-boxing programs to their own little address space?
Apologies again if this is simple or stupid, even after reading the OSDev wiki on paging and some of the related pages and even reading the 80386 programmers guide didn't really help me understand the concept.
Thanks in advance.