Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
This means that I can access the page directory at address (4GB - 4MB), right? So I use two macros for getting the PTE and PDE of a virtual address. But when I try to access the PDE, I get a page fault:
did you flush the Translation Lookaside Buffers after you set up your page directory entries ?
i think your "PDE" macro is wrong.
*pde(virt) should refer to the page directory entry for VIRT, right ? this is (imho) located at PG_DIR_START + 1023*PG_TABLE_SIZE + (virt>>22)*PTE_SIZE, not where you set it
Alright, I flush the TLB by moving cr3 to eax and eax back to cr3...
Now after setting up the self mapping and enabling paging, I flush the TLB...but it still doesn't work...neither with your version of ADDR_TO_PDE