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.
Hi... Been struggling with this for a while. The CPU tripplefaults.
I have a higher half kernel basically made with the Tim R. GDT trick. I'm beginning the preparations for multitasking which involves cloning a PD. I have a working (mostly) heap, paging and allocation seems to work. But now that I try to create a new page directory and load it's physical address to cr3 the cpu crashes.
There's something I don't quite understand for example:
kernelpagedirPtr = (char *)kernelpagedir + 0x40000000; // Translate the page directory from
// virtual address to physical address
lowpagetablePtr = (char *)lowpagetable + 0x40000000; // Same for the page table
Why do we need to translate pd from virtual to physical? Paging is not yet enabled at that point...
I suggest to depart from tutorial design before going further stuff like multi-tasking.
The GDT trick, as you might already know, is a trick. Having all +0x40000000 around isn't that nice IMO.
If you separate physical page allocator, logical address space management then cloning page dir become as easy as:
So... This is just a step to the direction. I have had too much other stuff to do so this is going forwards a bit slower than I wished. I'll post this just incase someone is having a same sort of problem. Just to give direction or an idea, that is.
Gonna be posting the full solution as soon as I have time more time for this project again =)
Spot a bug, pagedir and his friends are local variable, which the life ends as soon as the function returns.
So, the CR3 will reference to random content as the OS runs
That is correct. But since I've been asked if I could post what I've got (so far) I figured it won't hurt anyone even if this is still in babysteps. =)
I'm Eino Tuominen from Finland, a web software dev learning low level stuff and reading / trying out kernel dev