Page 1 of 1

Page faults?

Posted: Mon Mar 24, 2008 7:56 am
by t6q4
Hi there,
I have touched JamesM's tutorials again, in a long time and found it pleasing to find a new tutorial about multitasking. I re-implemented paging and a kernel heap to try it out. I start up my kernel - and it page faults. The weird thing is though, (look at screenshot attached) sometimes the page fault happens after the debug output for the monitor driver , before the "Kernel has been initialised" text, and sometimes it happens after the SIG_FREEZE (I implemented 'shortcuts' for coming back to different functions later). I copied the code exactly from the website and even replaced that with the downloaded code. Please help! I dont know what is happenning!

If you want the code for a particular file, please ask, as long as you can use it to help me!

Posted: Mon Mar 24, 2008 9:09 am
by JamesM
Does that EIP look slightly incorrect to you?

Posted: Mon Mar 24, 2008 10:58 am
by t6q4
Yes, I figured that the EIP was the faulting address. That's part of the problem - I dont know why it is actually faulting there.

Posted: Mon Mar 24, 2008 2:41 pm
by JamesM
Well, it's obviously jumping off into somewhere bad. That usually means stack corruption.

Have you tried putting printf's in everywhere?

Posted: Sat Apr 26, 2008 2:58 pm
by t6q4
Sorry for delaying the reply, I was busy...
Anyways, I hacked the code to make it work - I added a con_write(""); between the current_directory = current_task->page_directory; and the asm code that follows it. But now my forked process only runs twice. Can you explain why, please?

Posted: Mon Apr 28, 2008 1:46 am
by JamesM
t6q4 wrote:Sorry for delaying the reply, I was busy...
Anyways, I hacked the code to make it work - I added a con_write(""); between the current_directory = current_task->page_directory; and the asm code that follows it. But now my forked process only runs twice. Can you explain why, please?
Uh... no? Firstly, I don't know your code. Secondly, you've bodged my code onto yours. Thirdly, you've put in a rather hellish hack that is obviously just surpressing symptoms and not fixing the problem.

Cheers,

James

Posted: Tue Apr 29, 2008 7:30 am
by z180
Maybe you could restart your MM code and read more examples?
My MM code also started out in an not the right thing way.I cant
give you my mm code,I lost it before really finished.