0

I'm currently working on an x86_64 kernel as a personal project and I'm running into a page fault error when trying to write to memory. I've checked my code and I believe I've set up my paging structures correctly. However, I'm still running into this error and I'm not sure how to debug it further.

Here's a brief overview of my code:

I'm using a PageTableManager to manage my paging structures. I'm using the MapMemory function to map virtual memory addresses to physical memory addresses. I'm using the LockPages function to lock the kernel pages in memory. I've checked that my kernel code is running in the correct memory range. However, when I try to write to memory, I get a page fault error

I've also checked that the ReadWrite bit is set correctly in my paging structures, so I'm not sure what's causing this error.

If anyone has experience debugging page fault errors in an x86_64 kernel, I would greatly appreciate any advice or guidance. Thank you in advance!

this is the github repo where you can chek out the code

  • So your first problem is you posted an URL where you should have posted some code; preferably a stripped down version of your code which can fit in a reasonable summary. – mevets Mar 30 '23 at 02:29
  • Secondly, checking code is wonderful. Checking data is magic. Print out the page table entries (one per level) used to form your address. Check all the bits against the manual. – mevets Mar 30 '23 at 02:31
  • Next, if that doesn't help, get Bochs and run your code in it. It has wonderful diagnostic abilities; and if all else fails, you can run Bochs under gdb and set a breakpoint where it raises a pagefault, then look back in its call stack to see why it thought the page was bad. – mevets Mar 30 '23 at 02:33

0 Answers0