Page 1 of 1

Higher Half bare bones page question

Posted: Fri Dec 14, 2007 6:37 am
by blound
I was following:

http://www.osdev.org/wiki/Higher_Half_bare_bones

and noticed it used 4mb pages. I know that you can have your kernel at the 3gb limit with 4k pages so I know it cannot be a requirement. I tried taking the "4mb specific" stuff out mostly

1) changing the PDE to 3 ( keeps present/rw, removes 4mb)
2) commented out the 3 lines that or cr4 with the 4mb

the shift and the rest were ok for 4k or 4mb pages ( i think ) so I did not touch those

Has anyone else modded that code to work for 4k pages or is it not possible?

Edit: forgot the debugging info!

It dies at:

Code: Select all

Next at t=10238627
(0) [0x00100280] 0008:100280 (unk. ctxt): lea ecx, dword ptr ds:0xc0100288 ; 8d0d880210c0
so its in the tutorial here:

Code: Select all

    ; Start fetching instructions in kernel space.
    lea ecx, [StartInHigherHalf]
    jmp ecx                                                     ; NOTE: Must be absolute jump!

Posted: Fri Dec 14, 2007 6:45 am
by Combuster
The key to using 4MB pages is that you only need one PD with only one entry, which greatly simplifies the setup.

It can be done with 4K pages, but you'll need to construct an additional page table, and fill all entries to point to each 4096 bytes between 0M and 4M. That isn't something that a half decent assembly programmer can not do.

Posted: Fri Dec 14, 2007 6:51 am
by blound
*smacks head against desk*

I will start on that now thanks!