Code: Select all
extern int end;
int base = (int)&end;
void enablepage()
{
if (base & 0xFFFFF000)
{
base &= 0xFFFFF000;
base += 0x1000;
}
pageDirectory = (unsigned int*)base;
pageTable = (unsigned int*)(base + 0x1000);
initializepage();
}
Code: Select all
00033080153i[CPU0 ] EFER = 0x00000000
00033080153i[CPU0 ] | RAX=0000000080000011 RBX=000000000002d000
00033080153i[CPU0 ] | RCX=00000000000b8000 RDX=000000000011efc4
00033080153i[CPU0 ] | RSP=0000000000067e38 RBP=0000000000067e38
00033080153i[CPU0 ] | RSI=0000000000053c8e RDI=0000000000053c8f
00033080153i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00033080153i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00033080153i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00033080153i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00033080153i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf SF zf af PF cf
00033080153i[CPU0 ] | SEG selector base limit G D
00033080153i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00033080153i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00033080153i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00033080153i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00033080153i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 000fffff 1 1
00033080153i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00033080153i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00033080153i[CPU0 ] | MSR_FS_BASE:0000000000000000
00033080153i[CPU0 ] | MSR_GS_BASE:0000000000000000
00033080153i[CPU0 ] | RIP=00000000001042ee (00000000001042ee)
00033080153i[CPU0 ] | CR0=0x80000011 CR1=0x0 CR2=0x00000000001064c0
00033080153i[CPU0 ] | CR3=0x00200000 CR4=0x00000000
00033080153i[CPU0 ] (instruction unavailable) page not present
00033080153e[CPU0 ] exception(): 3rd (14) exception with no resolution, shutdown status is 00h, resetting
Code: Select all
void enablepage()
{
pageDirectory = (unsigned int*)0x200000;
pageTable = (unsigned int*)(0x200000 + 0x1000);
initializepage();
}
I remembered someone told me i can put the page directory and page table at any place in the available memory.
could someone tell me what's wrong with my code?