Hello, thanks for the quick replys
AR wrote:
I assume PACKED is defined as __attribute__((packed)) which should make sure it's packed.
yup PACKED is defined in sys/types.h as #define PACKED __attribute__( (packed) )
I'm nearly sure that the paging code is ok as it seemed to work when the kernel was linked to run at its physical address, e.g. I could map the video memory to some high location and successfully write to the console at that point.
AR wrote:
Paging is under segmentation, you need to map the kernel at both 0x00101000 and 0xC0000000, once you load a flat segment you can remove the 0x00101000 mapping.
Ya im guessing that as im trying to do this under segmentation with a base of 0x40101000 that its causing problems. From PAGING.C:
Code:
// identity map bottom 4MB's
for( physicalAddress=0L ; physicalAddress<(1024*SIZE_4KB) ; physicalAddress+=SIZE_4KB )
paging_setPageTableEntry( physicalAddress, physicalAddress, TRUE );
// map the kernel's virtual address to its physical memory location
linearAddress = 0xC0000000;
// 0x00101000 = &start (start in loader.asm which is the kernel entry point)
for( physicalAddress=(DWORD)0x00101000; physicalAddress<(DWORD)(0x00101000+(1024*SIZE_4KB)) ; physicalAddress+=SIZE_4KB )
{
paging_setPageTableEntry( linearAddress, physicalAddress, TRUE );
linearAddress += SIZE_4KB;
}
I think this does what you said though, the bottom 4MB's includes the kernel and then I also map it to its new virtual location of 0xC000000