"3rd (14) exception with no resolution" in paging mode

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
lpoulain
Member
Member
Posts: 38
Joined: Mon Dec 21, 2015 7:09 pm

"3rd (14) exception with no resolution" in paging mode

Post by lpoulain »

Hello all,

Starting to develop my own OS, I hit a wall whenever I try to switch to paging mode. The boot loader successfully loads the kernel at address 0x1000, switches to 32-bit protected mode and executes the kernel. However, whenever the kernel tries to switch to paging mode I get the following error (the page fault handler that I registered never gets called):

Code: Select all

exception(): 3rd (14) exception with no resolution, shutdown status is 00h, resetting
I tried to reuse the code from http://www.jamesmolloy.co.uk/tutorial_h ... aging.html to make sure that the page directory and interrupt handling was properly configured, but I still get a crash. I suspect that my boot loader is doing something that the processor doesn't like (I tried using grub, but using it seems to be challenging on OS X)

Any thought on what I could do wrong?

Thanks in advance.
FusT
Member
Member
Posts: 91
Joined: Wed Sep 19, 2012 3:43 am
Location: The Netherlands

Re: "3rd (14) exception with no resolution" in paging mode

Post by FusT »

Have you verified your IDT and GDT are setup and valid?

Edit: Also, it's very difficult to tell what's wrong with your code when you're not providing any. I'm not saying "dump your complete source here", but the relevant parts would certainly be helpful.
Last edited by FusT on Tue Dec 22, 2015 1:20 am, edited 1 time in total.
Octocontrabass
Member
Member
Posts: 5588
Joined: Mon Mar 25, 2013 7:01 pm

Re: "3rd (14) exception with no resolution" in paging mode

Post by Octocontrabass »

lpoulain wrote:I tried to reuse the code from http://www.jamesmolloy.co.uk/tutorial_h ... aging.html to make sure that the page directory and interrupt handling was properly configured,
That's not a good source for working code.
User avatar
Quaker763
Posts: 17
Joined: Sun Mar 08, 2015 5:32 am
Location: Straya

Re: "3rd (14) exception with no resolution" in paging mode

Post by Quaker763 »

As said above, can you provide some more information, especially the values in CRx registers.

I know a few people have had issues ripping James M's code from the site (the downloaded version is fixed). Anyway, something to check for is CR0 = CR2. If this is the case, make sure you have correctly identity mapped the first 4MB of memory. What happens is (if first 4mb is not mapped) that the processor tries to jump back to the previous instruction, but since all adresses are now virtual, a page fault occurs. The IDT is then inaccesible, which causes another page fault until a triple fault occurs and the processor just gives up and reboots.

Hope that helps!
lpoulain
Member
Member
Posts: 38
Joined: Mon Dec 21, 2015 7:09 pm

Re: "3rd (14) exception with no resolution" in paging mode

Post by lpoulain »

Thank you for the responses.

After some further debugging (as well as some luck), I was able to get this working, although I am not entirely sure why.

The CR0 registered indicated that the page fault happened when the kernel tried to access the page directory. And the error disappears after I allocate some static data before allocating it. Apparently the page directory must be located above 1 Mb in the address space - at least in my case.

@Octocontrabass: you say that my source for working code is not a good source. Fair enough. Any good source you would recommend?
Post Reply