Page not present after TLB invalidation

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.
Post Reply
snijj
Posts: 17
Joined: Sat Apr 04, 2015 9:35 am
Location: Scarborough, UK

Page not present after TLB invalidation

Post by snijj »

Hi,

I've been working on a new paging implementation for my kernel for a few days now but have been running into some problems when creating a new page table. I'll list out the scenario that is causing the issue.
  • The VMM is asked to acquire the page at 0x01000000. It asks for a physical frame and then talks to the paging implementation to get the frame mapped.
  • The paging implementation checks for the presence of a page table, doesn't find one...
  • A new page table is created and a full flush of the TLB occurs to ensure the page table is seen. (Debugging in BOCHs reveals that the page table that is created is correctly mapped in the linear address space).
  • The page entry is added into the new page table (debugging this shows the entry is correctly written into the table/memory). A invlpg instruction is then issued for the page.
  • Attempting to access the page results in a Page not present exception.
I have tested this behaviour in both BOCHS and QEMU and they both exhibit the same issue.

The paging implementation that I've got so far can be found at https://github.com/tjhancocks/vkernel/b ... 6/paging.c.

I'm not entirely sure why the linear address remains invalid after invalidating the page and/or updating CR3. But its probably something small that I'm missing and just not noticing.

Any help would be greatly appreciated, thanks!
snijj
Posts: 17
Joined: Sat Apr 04, 2015 9:35 am
Location: Scarborough, UK

Re: Page not present after TLB invalidation

Post by snijj »

I've managed to solve the issue myself. I had managed to accidentally create a duplicate of the page directory that had almost identical contents, but ever so slightly different. Enough to make the whole thing not work correctly.
Post Reply