Page faults?

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
User avatar
t6q4
Member
Member
Posts: 25
Joined: Thu Feb 14, 2008 3:56 pm

Page faults?

Post 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!
Attachments
Page fault!
Page fault!
pagefault.png (23.83 KiB) Viewed 1675 times
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Does that EIP look slightly incorrect to you?
User avatar
t6q4
Member
Member
Posts: 25
Joined: Thu Feb 14, 2008 3:56 pm

Post 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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Well, it's obviously jumping off into somewhere bad. That usually means stack corruption.

Have you tried putting printf's in everywhere?
User avatar
t6q4
Member
Member
Posts: 25
Joined: Thu Feb 14, 2008 3:56 pm

Post 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?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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
z180
Member
Member
Posts: 32
Joined: Tue Mar 04, 2008 12:32 pm

Post 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.
Post Reply