mapping pages > 1 GB, something wrong
Posted: Sun Jan 09, 2005 9:22 pm
Hello!
I've got a problem with my page mapper, but I can't find out what it is, it seems that if I map a page in a page directory entry > 256, it won't get mapped in vmware or on real hardware, but it will in Bochs.
This is my page mapper:
I pass PAGE_PRESENT|PAGE_WRITE to both _pteatt and _pdeatt.
I've got a problem with my page mapper, but I can't find out what it is, it seems that if I map a page in a page directory entry > 256, it won't get mapped in vmware or on real hardware, but it will in Bochs.
This is my page mapper:
Code: Select all
#define PDE_BASE 0xFFFFF000
#define PTE_BASE 0xFFFFF000
#define PAGE_PO(addr) ((uint32)(addr) & 0x3FF)
#define PAGE_PTE(addr) (((uint32)(addr) >> 12) & 0x3FF)
#define PAGE_PDE(addr) (((uint32)(addr) >> 22) & 0x3FF)
bool MapPage(uint32 *_pdbr, uint32 *_virtual, uint32 *_physical, uint32 *_pdeatt, uint32 *_pteatt)
{
_virtual = PAGE_ALIGN(_virtual);
uint32 iPDE = PAGE_PDE(_virtual),
iPTE = PAGE_PTE(_virtual),
iPO = PAGE_PO(_virtual);
SetPagingEnabled(false);
uint32 *pPageTable = (uint32 *)((uint32)_pdbr[iPDE] & PDE_BASE);
if (!pPageTable)
{
pPageTable = AllocatePage();
_pdbr[iPDE] = ((uint32)pPageTable & PDE_BASE) | _pdeatt;
}
pPageTable[iPTE] = (((uint32)_physical & PTE_BASE) | _pteatt);
SetPagingEnabled(bEnabled);
return true;
}