Making 4kb higher half kernel

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
4nt01
Posts: 3
Joined: Fri Oct 19, 2018 9:59 am

Making 4kb higher half kernel

Post by 4nt01 »

I want to make an higher halv kernel with 4kb pages instead of MB ones. Can you help me? I don't especially understand the part where BootPageDirectory is filled...
glauxosdever
Member
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Making 4kb higher half kernel

Post by glauxosdever »

Hi,


Could you please link to the guide you are following?

However, I'd suggest you read the theory behind paging first. :-)


Regards,
glauxosdever
4nt01
Posts: 3
Joined: Fri Oct 19, 2018 9:59 am

Re: Making 4kb higher half kernel

Post by 4nt01 »

Oh sorry, sure https://wiki.osdev.org/Higher_Half_x86_Bare_Bones I've read theory but to actually code it I didn't have any idea so it helped me
User avatar
flerovium
Posts: 8
Joined: Tue May 15, 2012 10:11 am

Re: Making 4kb higher half kernel

Post by flerovium »

Usually the page tables you setup in your pre-main initialization routine is just a preliminary mapping.
You will want to setup a proper mapping later anyways and you can use 4KiB pages to map your kernel if you want.
Also using 2MiB pages does not exclude using 4KiB pages for other things.
4nt01
Posts: 3
Joined: Fri Oct 19, 2018 9:59 am

Re: Making 4kb higher half kernel

Post by 4nt01 »

Oh man, didn't understand that! Now I have only one question. When does I have to create a new page directory or a new page directory and where should I put those?
User avatar
flerovium
Posts: 8
Joined: Tue May 15, 2012 10:11 am

Re: Making 4kb higher half kernel

Post by flerovium »

It largely depends on how you plan to structure your memory management...
You propably want a way to allocate physical pages before setting up your new tables.
You can then use a recursive mapping to access the allocated tables (PD, PT) in virtual memory.
Post Reply