Grub loads my kernel code at physical location of 0x00101000 but it is linked to be at virtual address of 0xC0000000
I had my kernel working when it was linked as virtual=physical but I want to move it up the the 3GB mark. I've used Tims trick to use a GDT with segment offsets that give me 0xC0000000 + 0x40101000 = 0x00101000. This works fine and I jump into my kernel code.
Now I want to setup and enable paging and then load new linear code/data segments and continue on with things.
Setting up the linear segments is fine but my paging code triple faults Bochs. (paging seemed to work when linked to virtual=physical). My code is on SourceForge and I would be eternally gratefull if somebody could have a look through it and spot the problem(s). My heads spinning and fresh eyes are definatly needed
loader.asm sets up the GDT with the special base's and jumps into the kernel address space (0xC0000000) which inturn calls main() in kernel.c. Here we setup paging in paging.c and then back in kernel.c the newly created page directory is installed and then the linear code/data descriptors will be put inplace. It triple faults around loadind cr3 with the page directory in kernel.c. I've tried following all similar threads about this topic but no joy.
LOADER.ASM http://cvs.sourceforge.net/viewcvs.py/osamos/AMOS/src/kernel/loader.asm?view=markup
KERNEL.C http://cvs.sourceforge.net/viewcvs.py/osamos/AMOS/src/kernel/kernel.c?view=markup
PAGING.C http://cvs.sourceforge.net/viewcvs.py/osamos/AMOS/src/kernel/mm/paging.c?view=markup
This code in kernel.c was for testing as 0x00000000 = *pagedirectory
Code: Select all
// Enable Paging...
__asm__ __volatile__ ( "movl %%eax, %%cr3" : : "a" ( 0x00000000 ) );
Any and all help greatly appreciated, cheers