Setting Up Paging: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Line 24:
If you know where the end of your kernel is, then you can put the page directory right after it.
 
Note that all of your paging structures need to be at page aligned addresses, so it's probably a good idea to make a page allocator first and have that dish out pages for your paging code. Until you create a proper page allocator though, simply finding the first free page-aligned address after the kernel will be fine.
 
<pre>
//the page directory comes right after the kernel - NOTE: make sure the address is page aligned!
unsigned int *page_directorypage_aligned_end = (((unsigned int*)end) & 0xFFFFF000) + 0x1000;
unsigned int *page_directory = (unsigned int*)page_aligned_end;
</pre>
 
Line 35 ⟶ 36:
<pre>
//this is only a temporary solution. Find out where your kernel ends!
unsigned int *page_directory = (unsigned int*) 0x9C000;//Make sure that this address is properly page aligned
</pre>