I'm reading (and understanding) the tutorial of James Molley, and I have a (for you maybe simple) problem. When I enable paging after the 6th tutorial, I can't use kmalloc (in the same tutorial) anymore. I get a page fault (the page exists, but is read-only).
So my question is:
1. Why do I get this error?
and...
2. How can I fix it?
Page Fault
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: Page Fault
Well, you clearly go to line ??? in ???.c in your code and change ??? to ???.
I'd suggest that you post your code here (use slexy or pastebin, or link to a file somehow. Unless its short, then you can post it here).
Also, are you using that downloadable code or the cod on the site? Because the code on the site isn't perfect...there are mistakes, IIRC. Try downloading the code and comparing that to yours.
-JL
I'd suggest that you post your code here (use slexy or pastebin, or link to a file somehow. Unless its short, then you can post it here).
Also, are you using that downloadable code or the cod on the site? Because the code on the site isn't perfect...there are mistakes, IIRC. Try downloading the code and comparing that to yours.
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Re: Page Fault
piranha wrote:[...]Because the code on the site isn't perfect...there are mistakes, IIRC.[...]
-JL
However, here's my paging.c (but it isn't documented yet! that's why I didn't post it).
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Page Fault
Please stop copy-pasting tutorials. It is irritating. It demonstrates incompetence. How many times are people going to have to debug JamesM's (yes, it is JamesM's, not yours) code, and for how many unprepared, unequipped, big-dreaming zeroes?
Please, if you are not equipped to build an operating system, do not attempt to begin one. Or, should you find it expedient to waste your time tinkering around with someone else's code, don't post up the problems for the general community to see. Contact the person whose code you're ripping off.
See if JamesM is interested in helping you make his source code work for you. Most likely he isn't.
Apart from that: You have put your question forward in a stupid way.
What makes you think that everyone else here is riding JamesM's...tide and that everyone therefore should know exactly what goes on in the '6th tutorial'? This is your problem. Therefore you have to engage us intellectually enough for us to be interested. I don't know what's going on with the newcomers, but as far as I know, not only on forums, but also in wider society, when you are the one seeking help, you normally present all the salient points, and make them available in the absolute most convenient manner possible so as to alleviate the workload placed on the person(s) whom you are burdening. This is basic social common sense.
But you have given a link, and you expect people to what? Follow it, and because you're so special, and you deserve special treatment, and since everyone here is present simply for your own convenience, we should refresh our memories on what goes on in the article, and then, since you didn't even tell which line your error occurs on, we should, of course, take our time to deduce this for you, and then aid you on your journey to nowhere?
If you return and say "Well you know, I don't know what line the error occurs on..." then is will simply mean that you have broken the forum rules yet again: You obviously have not debugged the problem and found out where it arises. The first step in any kind of debugging is to trace the problem back to its execution area. So where do you map in your page tables? Check the code. Find out which flags you fill in to map them out.
And there's more: Your very question indicates that you are not remotely well read, and that you should not be posting on these forums, since the rules adamantly require you to have READ the Intel Manuals, and that you are not equipped for systems programming.
http://catb.org/~esr/faqs/smart-questions.html
http://lmgtfy.com/?q=intel+manuals
Read those two. Take the time to FULLY READ (not skim through) the Intel Manuals. Come back when you have met the intellectual requirements for Operating System Development.
Please, if you are not equipped to build an operating system, do not attempt to begin one. Or, should you find it expedient to waste your time tinkering around with someone else's code, don't post up the problems for the general community to see. Contact the person whose code you're ripping off.
See if JamesM is interested in helping you make his source code work for you. Most likely he isn't.
Apart from that: You have put your question forward in a stupid way.
What makes you think that everyone else here is riding JamesM's...tide and that everyone therefore should know exactly what goes on in the '6th tutorial'? This is your problem. Therefore you have to engage us intellectually enough for us to be interested. I don't know what's going on with the newcomers, but as far as I know, not only on forums, but also in wider society, when you are the one seeking help, you normally present all the salient points, and make them available in the absolute most convenient manner possible so as to alleviate the workload placed on the person(s) whom you are burdening. This is basic social common sense.
But you have given a link, and you expect people to what? Follow it, and because you're so special, and you deserve special treatment, and since everyone here is present simply for your own convenience, we should refresh our memories on what goes on in the article, and then, since you didn't even tell which line your error occurs on, we should, of course, take our time to deduce this for you, and then aid you on your journey to nowhere?
If you return and say "Well you know, I don't know what line the error occurs on..." then is will simply mean that you have broken the forum rules yet again: You obviously have not debugged the problem and found out where it arises. The first step in any kind of debugging is to trace the problem back to its execution area. So where do you map in your page tables? Check the code. Find out which flags you fill in to map them out.
And there's more: Your very question indicates that you are not remotely well read, and that you should not be posting on these forums, since the rules adamantly require you to have READ the Intel Manuals, and that you are not equipped for systems programming.
For the same reason anyone else would get a #PF from an x86 processor: because there was an inconsistency found with one of your pages.So my question is:
1. Why do I get this error?
"I'm reading (and cloning)..."I'm reading (and understanding)...
http://catb.org/~esr/faqs/smart-questions.html
http://lmgtfy.com/?q=intel+manuals
Read those two. Take the time to FULLY READ (not skim through) the Intel Manuals. Come back when you have met the intellectual requirements for Operating System Development.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: Page Fault
O sh**. And I see my error now.
I read his tutorial (and INDEED try to understand it) and copy-paste indeed his code to see what it does (and what it doesn't). And then (after a few lessons) I write my own version of my own OS (with help of wiki.osdev.org and http://www.osdever.net/tutorials/index). NOT HIS ONE! And now I have copied his version of his paging.c to MY os without making a backup, and that results (of course...) in a page fault. And I haven't my own paging.c anymore (I have to write a new one). So that's my error (when I tried to implement a stack).
I'm sorry that I've wasted your time asking a quesion. If you start blaming me with copy-pasting without even realising that somebody maybe makes a simple mistake with his own files, then I don't even want to ask a question here again. Why should I? And yes, I've read the rules. And I thought somebody would know the tutorial and help me with a bit of background-info about paging to help me with this quesion. I wasn't even talking about code!
I read his tutorial (and INDEED try to understand it) and copy-paste indeed his code to see what it does (and what it doesn't). And then (after a few lessons) I write my own version of my own OS (with help of wiki.osdev.org and http://www.osdever.net/tutorials/index). NOT HIS ONE! And now I have copied his version of his paging.c to MY os without making a backup, and that results (of course...) in a page fault. And I haven't my own paging.c anymore (I have to write a new one). So that's my error (when I tried to implement a stack).
I'm sorry that I've wasted your time asking a quesion. If you start blaming me with copy-pasting without even realising that somebody maybe makes a simple mistake with his own files, then I don't even want to ask a question here again. Why should I? And yes, I've read the rules. And I thought somebody would know the tutorial and help me with a bit of background-info about paging to help me with this quesion. I wasn't even talking about code!
Re: Page Fault
Hi Laurent,
Honestly, I see your point of view. You are however perhaps a little too defensive at being maligned to be objective about Graveara's perspective. Your original post did not include any information about the page fault, how it came about, any debugging you may have done, whether the code was entirely mine or only parts of it.
You've since provided more information but nowhere near the amount needed if we are to help you with your problem. There are a million and one reasons why a page fault could fire - almost all to do with buggy page tables.
So you'll need to help us more; and since you've read the rules, possibly work on your first-post styling a bit
James
... oh, and you spelled my name wrong. Even though it's spelled out for you in the site url.
Honestly, I see your point of view. You are however perhaps a little too defensive at being maligned to be objective about Graveara's perspective. Your original post did not include any information about the page fault, how it came about, any debugging you may have done, whether the code was entirely mine or only parts of it.
You've since provided more information but nowhere near the amount needed if we are to help you with your problem. There are a million and one reasons why a page fault could fire - almost all to do with buggy page tables.
So you'll need to help us more; and since you've read the rules, possibly work on your first-post styling a bit
James
... oh, and you spelled my name wrong. Even though it's spelled out for you in the site url.