paging problem
Posted: Sat Nov 15, 2003 8:04 am
Im new to this paging stuff. ı enable paging and change the address of the screen coordinates and want print a message to a different position of screen from expected position. (as I see in Alexie's pmode tutorial)
but next printing code prints new message onto old one. Where did I wrong?
Code: Select all
outtextxy(10, 10, "Old message");
initpaging();
outtextxy(10, 10, "New message");
Code: Select all
void InitPaging(void)
{
unsigned long *PageDirectory = (unsigned long *) 0x9C000;
unsigned long *PageTable = (unsigned long *) 0x9D000;
unsigned long Address=0;
unsigned int i;
for(i=0; i<1024; i++) {
PageTable[i] = Address | 3;
Address = Address + 4096;
};
PageDirectory[0] = PageTable;
PageDirectory[0] = PageDirectory[0] | 3;
// fill the rest of the page directory
for(i=1; i<1024; i++) {
PageDirectory[i] = 0 | 2;
};
//chage the screen position addresses...
Address = 0xBA000;
for (i=0xB8;i<0xBA;i++) {
Address -= 4096;
PageTable[i] = Address | 3;
}
WriteCR3((unsigned int)PageDirectory);
WriteCR0(ReadCR0() | 0x80000000);
}