Page 1 of 2
PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:03 am
by nifanfa
Hello! i want to implement PAE for my OS. and i read this article
https://wiki.osdev.org/Setting_Up_Paging_With_PAE
page_dir[0] = 0b10000011; //Address=0, 2MIB, RW and present
i wonder what does 0b10000011 mean.
and how i do i map the address like 0xFFFF_FFFF_FF00_0000 to 0xFFFF_FF00 ?
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:33 am
by iansjack
Have you read the chapter in the Intel (or AMD) Programmer's Manual on the subject?
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:47 am
by Octocontrabass
nifanfa wrote:i wonder what does 0b10000011 mean.
Are you asking about binary literals in C, or are you asking about
how the CPU will interpret that value?
nifanfa wrote:and how i do i map the address like 0xFFFF_FFFF_FF00_0000 to 0xFFFF_FF00 ?
You can't, 0xFFFF_FFFF_FF00_0000 is not a valid address.
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:48 am
by nifanfa
iansjack wrote:Have you read the chapter in the Intel (or AMD) Programmer's Manual on the subject?
no. where i can find them?
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:49 am
by nifanfa
Octocontrabass wrote:nifanfa wrote:i wonder what does 0b10000011 mean.
Are you asking about binary literals in C, or are you asking about
how the CPU will interpret that value?
nifanfa wrote:and how i do i map the address like 0xFFFF_FFFF_FF00_0000 to 0xFFFF_FF00 ?
You can't, 0xFFFF_FFFF_FF00_0000 is not a valid address.
ahh. isn't PAE designed for use memory above 4gb?
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:52 am
by iansjack
nifanfa wrote:iansjack wrote:Have you read the chapter in the Intel (or AMD) Programmer's Manual on the subject?
no. where i can find them?
On the Intel and AMD websites. They are essential reading.
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:55 am
by Octocontrabass
nifanfa wrote:no. where i can find them?
The Intel SDM is here. The AMD APM is here (in the "AMD64 Architecture" section).
nifanfa wrote:ahh. isn't PAE designed for use memory above 4gb?
Yes, you can use PAE to access physical addresses above 4GiB, but physical addresses are limited to 52 bits. The highest possible physical address is 0x000F_FFFF_FFFF_FFFF.
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:57 am
by iansjack
Octocontrabass wrote:
You can't, 0xFFFF_FFFF_FF00_0000 is not a valid address.
Why not (ignoring the underscores)? It's canonical.
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:57 am
by nifanfa
got. but how do i map address like 0xFFFFFFFF1 to 0xE0000000
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:58 am
by nifanfa
what i should do to page_dir
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 10:59 am
by nifanfa
and i got General Protection Exception if i map the first 2mb
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 11:00 am
by Octocontrabass
Do you understand how regular 32-bit paging works? The questions you're asking make it sound like you don't.
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 11:01 am
by nifanfa
Octocontrabass wrote:Do you understand how regular 32-bit paging works? The questions you're asking make it sound like you don't.
yes... i don't know about paging
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 11:17 am
by iansjack
nifanfa wrote:
got. but how do i map address like 0xFFFFFFFF1 to 0xE0000000
That you can't do, as you can only map a virtual page to a physical page. Both are aligned on 4K boundaries.
Re: PAE How to map the specific address?
Posted: Wed Oct 27, 2021 11:31 am
by deadmutex
>and how i do i map the address like 0xFFFF_FFFF_FF00_0000 to 0xFFFF_FF00 ?
You'd translate the virtual address into its pml4e number, pdpte number, etc., and then set the entries appropriately.