Higher Half bare bones page question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
blound
Member
Member
Posts: 70
Joined: Sat Dec 01, 2007 1:36 pm

Higher Half bare bones page question

Post 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!
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
blound
Member
Member
Posts: 70
Joined: Sat Dec 01, 2007 1:36 pm

Post by blound »

*smacks head against desk*

I will start on that now thanks!
Post Reply