Hi,
I am trying to the run the code downloaded from JamesM tutorial from the
multitasking section but I am getting a page fault.
Page fault! (present) at 0x106d7815 - EIP: 0x106d7815
PANIC(Page fault) at paging.c: 230.
I haven't made any change to the code.
I have seen another post reporting the same problem. If anyone has fixed this issue please
help me.
Multitasking not working in JamesM tutorial
Multitasking not working in JamesM tutorial
- Thanks
Vaibhav jain
Vaibhav jain
- 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: Multitasking not working in JamesM tutorial
Yo:
What is at paging.c, line 230?
--Peace out
gravaera
What is at paging.c, line 230?
--Peace out
gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: Multitasking not working in JamesM tutorial
It's better to set up kernel stack and (perhaps a few pages) user stack when initializing paging. Just allocate pages for them and load the base address into esp and ebp, and call another function using the new stack frame - or you may crash because of invalid memory access.
Re: Multitasking not working in JamesM tutorial
Indeed, it is shite.berkus wrote:It's not supposed to work, because that stack copying implementation is fragile and mostly invalid.
Whoever wrote it deserves a slap.
Re: Multitasking not working in JamesM tutorial
What about the data that is already there in the old stack and is being used ?It's better to set up kernel stack and (perhaps a few pages) user stack when initializing paging. Just allocate pages for them and load the base address into esp and ebp,
Could you please explain this ? I am not getting how will it result in invalid memory access and how calling a function would avoid it ?and call another function using the new stack frame - or you may crash because of invalid memory access.
- Thanks
Vaibhav jain
Vaibhav jain
Re: Multitasking not working in JamesM tutorial
main() uses the old stack. Once we switch to a new stack and call another function, we'll never return to main(). The old stack is abandoned.vjain20 wrote: What about the data that is already there in the old stack and is being used ?
Local auto variables are accessed using ebp (and also esp sometimes). Switching to a new stack meansvjain20 wrote:Could you please explain this ? I am not getting how will it result in invalid memory access and how calling a function would avoid it ?and call another function using the new stack frame - or you may crash because of invalid memory access.
Code: Select all
asm volatile ("mov %0, %%ebp" :: "r" (new_stack_bottom));
asm volatile ("mov %0, %%esp" :: "r" (new_stack_bottom));
Calling another function avoid invalid memory access by allocate space for local autos on the new stack frame, usually by moving esp first or use [ebp+offset] directly.