Understanding paging
Posted: Sun Jul 03, 2016 8:31 am
Hi,
I've found your wiki very helpful, I've had a couple of attempts at making an OS (purely to understand how it works) and it's been fun so far.
I've had two attempts at getting trying to get paging working, and I'm not quite sure I've understood it properly. I've looked through the wiki and have looked at other resources online, as well as having searched the forum, too.
The way I understand it is:
* A page directory is created and instructions are called to make it clear where the page directory is in the memory.
* 1024 page tables fall within the page directory.
* Each page table contains an address, which refers to a physical address in memory (starting from a 4KB aligned block) for which the virtual address corresponds to.
Right?
So, from what I understand, in theory, page directory 0, page table 0, is virtual address 0x0 to 0x1000 ?
If page directory 0/page table 0 referred to, say, 0x999000, then:
From what I understand, *a should equal 'a'. But in my code it doesn't. Is there something fundamental that I have missed here? (I have deliberately not attached any code just to check that I actually understand right!)
Any help is appreciated.
Thanks.
I've found your wiki very helpful, I've had a couple of attempts at making an OS (purely to understand how it works) and it's been fun so far.
I've had two attempts at getting trying to get paging working, and I'm not quite sure I've understood it properly. I've looked through the wiki and have looked at other resources online, as well as having searched the forum, too.
The way I understand it is:
* A page directory is created and instructions are called to make it clear where the page directory is in the memory.
* 1024 page tables fall within the page directory.
* Each page table contains an address, which refers to a physical address in memory (starting from a 4KB aligned block) for which the virtual address corresponds to.
Right?
So, from what I understand, in theory, page directory 0, page table 0, is virtual address 0x0 to 0x1000 ?
If page directory 0/page table 0 referred to, say, 0x999000, then:
Code: Select all
char *b =0x999000;
*b = 'a';
// ... Paging is enabled here and maps 0x0 to 0x999000
char *a = 0x0;
Any help is appreciated.
Thanks.