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.
I cannot switch to user mode while paging is enabled. Only then...but when it's disabled it works just fine. I have been struggling with this for a long time but cannot figure it out so I'm asking you guys for help.
Here's paging code:
Have you checked that pd.us/rw/present and pt.us/rw/present are set for all pages that are directly accessed from userland? The posted code does not do that.
Also, run your OS in bochs for more helpful crash messages (and dumps).
"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 ]
I didn't get the impression that a lack of effort was in place:
- he knew the point of error
- he knew the circumstances that contributed to the error
- he tried match the symptoms with information from the intel manuals.
TBH, that is more than you'd expect from the average newbie, let alone the occasional failures we have to endure.
Luckily for you that isn't his only problem as a pagefault alone should not result in a crash. And luckily for you, bochs gives pretty verbose messages for that class of problems.
@OP: that was a hint
"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 ]
Sorry for ressurecting 3-days-to-2-years old (or 2 beacuse of 29.2.2012, am I right?) topic.
I had same problem and this post helped me, but I'm just curious. Page Fault that didn't occur in his and also my case.
My code passes to user mode and it causes PF, because the "user" bit is set to 0. Why didn't PF occur? Is it because my PF handler is also located in page without "user" bit set? Or because interrupt entry has ring0 set?
You're looking for a very specific fact regarding the CPU. Shame on you for not reading the manual.
"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 ]