Higher-Half Kernel, GDT, Address Translation, Snuh?
Posted: Thu Jul 31, 2008 6:57 pm
Sorry if this has been asked before....
Recently I managed to move my kernel to the "higher-half" (at 0xC0100000) using a CS and DS with a base of 0x40000000 (ala wiki), and I noticed, after enabling paging, that if I don't identity map the space at 0x100000 to the end of the kernel's image (say 0x200000 for the sake of argument), the code will cause a page fault when I try to lgdt (specifically when I try to change the DS after doing an lgdt). -- even if I pass lgdt a virtual address in the higher-half space -- i know the CPU needs a physical address and I assume the address is translated if a virtual one is used....
Ok, fine.
But, does this mean, that I will have to map 0x100000 to 0x200000 AND 0xC0100000 to 0xC0200000 into every process' memory space in order to avoid a page fault (triple fault) when I enter my interrupt handler (which changes the CS and DS selectors)?
If that's the case, and BOTH memory ranges must be mapped in, then what's the point of the higher-half approach if the kernel (or at least the part containing the GDT and IDT) has to be mapped into the 0x100000 space just to function??
Hopefully that's clear enough

Recently I managed to move my kernel to the "higher-half" (at 0xC0100000) using a CS and DS with a base of 0x40000000 (ala wiki), and I noticed, after enabling paging, that if I don't identity map the space at 0x100000 to the end of the kernel's image (say 0x200000 for the sake of argument), the code will cause a page fault when I try to lgdt (specifically when I try to change the DS after doing an lgdt). -- even if I pass lgdt a virtual address in the higher-half space -- i know the CPU needs a physical address and I assume the address is translated if a virtual one is used....
Ok, fine.
But, does this mean, that I will have to map 0x100000 to 0x200000 AND 0xC0100000 to 0xC0200000 into every process' memory space in order to avoid a page fault (triple fault) when I enter my interrupt handler (which changes the CS and DS selectors)?
If that's the case, and BOTH memory ranges must be mapped in, then what's the point of the higher-half approach if the kernel (or at least the part containing the GDT and IDT) has to be mapped into the 0x100000 space just to function??
Hopefully that's clear enough