Kernel works on bochs not on qemu.
Posted: Sun Oct 20, 2013 3:18 pm
fasm, long mode
Memory mapped at phys 0000:0000:0000:0000 -> log 0000:0000:4000:0000 (+ 1 Gb). First gigabyte (log) is reserved to tasks. All tasks is loaded at 0000:0000:0000:0000 (log). Each task has own PML3 (PDP) page table. When I switch task, I rewrite PML3[0] like that:
My log:
Second, I don't know why qemu do that.
Please, help me.
Memory mapped at phys 0000:0000:0000:0000 -> log 0000:0000:4000:0000 (+ 1 Gb). First gigabyte (log) is reserved to tasks. All tasks is loaded at 0000:0000:0000:0000 (log). Each task has own PML3 (PDP) page table. When I switch task, I rewrite PML3[0] like that:
Code: Select all
KERNEL_ORG = 1024*1024*1024 ; 1 Gb
mov rax,[rsi + Task.PML3]
mov [PML3_PHYS + KERNEL_ORG],rax
wbinvd
Bochs:task old_task (ID) -> new_task
and new task PML trace:
cr3 -- PML4[0] ; (PML4) 512 Gb pages
cr3 -- PML3[0] ; (PDP) 1 Gb pages
cr3 -- PML2[0] ; (PD) 2 Mb pages
cr3 -- PML1[0] ; (PT) 4 kb pages
Qemu:task 0000:0000:4009:E870 -> 0000:0000:4009:A870
cr3 -- 0000:0000:0000:4027
cr3 -- 0000:00007007
cr3 -- 0000:00008007
cr3 -- 0000:0000A007
task 0000:0000:4009:A870 -> 0000:0000:4009:E870
cr3 -- 0000:0000:0000:4027
cr3 -- 0000:0000B007
cr3 -- 0000:0000C007
cr3 -- 0000:0000E007
task 0000:0000:4009:E870 -> 0000:0000:4009:A870
cr3 -- 0000:0000:0000:4027
cr3 -- 0000:00007007
cr3 -- 0000:00008027
cr3 -- 0000:0000A027
First of all, I don't know why "0x27" at PML. I was set 7 (PG_PRESENT + PG_WRITEABLE + PG_USER) everywhere.task 0000:0000:407D:CB70 -> 0000:0000:4009:B470
cr3 -- 0000:0000:0000:4027
cr3 -- 0000:00007C07
cr3 -- 0000:00008C07
cr3 -- 0000:0000AC07
exc PF cr2 0000:0000:0000:0000
Second, I don't know why qemu do that.
Please, help me.