Enabling Paging
Posted: Fri Jul 23, 2010 11:43 pm
Code:
Bochs Log:
This kernel runs at 0x100000 (1MB) in physical memory and maps itself to 1MB in virtual memory (correctly) so there should be no problem, when I enable paging, with the IP, it should just continue along smoothly because the code it was running before the addressing mode switch is still in the exact same place. However, according to Bochs log, cr3 is not setting to the address it should be, where there is a formatted page directory waiting. Also interrupts were obviously disabled prior to this, but I'm still triple faulting on the page fault (14). It looks like the real problem is cr3 isn't setting. Help appreciated,
Brodeur235
Code: Select all
mov eax,DWORD [ds:KLOC(.page_dir_addr)]
mov cr3,eax
mov eax,cr0
or eax,0x80000000
mov cr0,eax
Code: Select all
00014041523i[BIOS ] Booting from 0000:7c00
00016224067i[CPU0 ] CPU is in protected mode (active)
00016224067i[CPU0 ] CS.d_b = 32 bit
00016224067i[CPU0 ] SS.d_b = 32 bit
00016224067i[CPU0 ] EFER = 0x00000000
00016224067i[CPU0 ] | RAX=00000000e0000011 RBX=0000000000001000
00016224067i[CPU0 ] | RCX=0000000000000404 RDX=0000000000000400
00016224067i[CPU0 ] | RSP=0000000000009fd7 RBP=0000000000009ff7
00016224067i[CPU0 ] | RSI=00000000000e476c RDI=000000000000ffac
00016224067i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00016224067i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00016224067i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00016224067i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00016224067i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf SF zf af PF cf
00016224067i[CPU0 ] | SEG selector base limit G D
00016224067i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00016224067i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 ffffffff 1 1
00016224067i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00016224067i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00016224067i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00016224067i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00016224067i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00016224067i[CPU0 ] | MSR_FS_BASE:0000000000000000
00016224067i[CPU0 ] | MSR_GS_BASE:0000000000000000
00016224067i[CPU0 ] | RIP=0000000000101af7 (0000000000101af7)
00016224067i[CPU0 ] | CR0=0xe0000011 CR2=0x0000000000007ee8
00016224067i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00016224067i[CPU0 ] 0x0000000000101af7>> popad : 61
00016224067e[CPU0 ] exception(): 3rd (14) exception with no resolution, shutdown status is 00h, resetting
00016224067i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00016224067i[CPU0 ] cpu hardware reset
Brodeur235