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.
Well the error code tells you that you tried to write to a page that you weren't authorised to. Your page table should reveal why that is so. Only you know what entries are in your tables and what instruction corresponds to the value in eip.
No, it has to be the first. A double fault/triple fault can only be invoked if the system is unable to nest the relevant exception handlers. If it can even get as far as to try and execute the first instruction of an exception handler, the entire exception has already been handled from the processor's point of view: all the registers have been set and the return addresses and error codes have been put on the stack, and it is therefore possible to return to the original code even when a new exception or interrupt would fire after that point.
In other words, if an exception is caused by the first instruction of an exception handler, then that starts a separate chain.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
No, it has to be the first. A double fault/triple fault can only be invoked if the system is unable to nest the relevant exception handlers. If it can even get as far as to try and execute the first instruction of an exception handler, the entire exception has already been handled from the processor's point of view: all the registers have been set and the return addresses and error codes have been put on the stack, and it is therefore possible to return to the original code even when a new exception or interrupt would fire after that point.
In other words, if an exception is caused by the first instruction of an exception handler, then that starts a separate chain.
Had to think about it for a moment because I forgot that "double fault" has its own handler. You're right; the ordering would probably be #PF>#PF becomes #DF with error code mentioning that the second (or first? It's been a while since I read any sort of reference) fault was a page fault>#PF resets system because triple fault, more likely than not, I believe.
It still brings up the question of why his page fault handler is in a page that's marked "not present", though.
That is the question but there are likely a lot more bugs/problems/design flaws in the code than just this one.
Browsing through the repository it's easy to see all of the paging/heap/multitasking code is based on JamesM's tutorial, which has a lot of problems
I'd especially be looking at this: http://wiki.osdev.org/James_Molloy%27s_ ... page_fault
MDenham wrote:It still brings up the question of why his page fault handler is in a page that's marked "not present", though.
Can you even conclude that if we know by fact of a triple fault that an exception handler could not be executed at all?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
MDenham wrote:It still brings up the question of why his page fault handler is in a page that's marked "not present", though.
Can you even conclude that if we know by fact of a triple fault that an exception handler could not be executed at all?
...We can't even validly conclude that the initial fault was a page fault, because one of the other fault handlers may have swapped out and/or flagged the page with the initial instruction as "not present". (If this were on real hardware rather than in Bochs, this could also be chalked up to #DF leaving EIP undefined. Bochs, however, is somewhat more reasonable and leaves EIP in a well-defined state at the time of a double fault.)
We do know that the last fault was a page fault caused by something being wrong with the double fault handler (either the IDT itself is on a page currently marked "not present", or for #DF it's pointing to something on a page marked "not present"... assuming reasonable code, at least); beyond that, the debug output would be necessary to actually determine what happened prior to that.
FusT wrote:That is the question but there are likely a lot more bugs/problems/design flaws in the code than just this one.
Browsing through the repository it's easy to see all of the paging/heap/multitasking code is based on JamesM's tutorial, which has a lot of problems
I'd especially be looking at this: http://wiki.osdev.org/James_Molloy%27s_ ... page_fault