PAE How to map the specific address?

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.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

PAE How to map the specific address?

Post 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 ?
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: PAE How to map the specific address?

Post by iansjack »

Have you read the chapter in the Intel (or AMD) Programmer's Manual on the subject?
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: PAE How to map the specific address?

Post 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.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: PAE How to map the specific address?

Post 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?
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: PAE How to map the specific address?

Post 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?
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: PAE How to map the specific address?

Post 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.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: PAE How to map the specific address?

Post 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.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: PAE How to map the specific address?

Post by iansjack »

Octocontrabass wrote: You can't, 0xFFFF_FFFF_FF00_0000 is not a valid address.
Why not (ignoring the underscores)? It's canonical.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: PAE How to map the specific address?

Post by nifanfa »

Octocontrabass wrote:
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.
got. but how do i map address like 0xFFFFFFFF1 to 0xE0000000
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: PAE How to map the specific address?

Post by nifanfa »

what i should do to page_dir
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: PAE How to map the specific address?

Post by nifanfa »

and i got General Protection Exception if i map the first 2mb
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: PAE How to map the specific address?

Post by Octocontrabass »

Do you understand how regular 32-bit paging works? The questions you're asking make it sound like you don't.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: PAE How to map the specific address?

Post 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
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: PAE How to map the specific address?

Post 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.
User avatar
deadmutex
Member
Member
Posts: 85
Joined: Wed Sep 28, 2005 11:00 pm

Re: PAE How to map the specific address?

Post 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.
Post Reply