How to map to 0xffffffff80000000 - -> 0xffffffffffffffff

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
markq
Posts: 24
Joined: Fri Jan 30, 2015 3:42 pm

How to map to 0xffffffff80000000 - -> 0xffffffffffffffff

Post by markq »

According this this tutorial (http://wiki.osdev.org/Creating_a_64-bit ... ual_Memory) the linux kernel maps physical memory starting from 0x0 to the region 0xffffffff80000000 - -> 0xffffffffffffffff which is -2gb. I have setup up the PML4, PDPT, PD and PT tables but these only maps to positive virtual memory addresses. How do you map to negative virtual addresses? Do I have to flip like a sign bit some where?
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: How to map to 0xffffffff80000000 - -> 0xffffffffffffffff

Post by kzinti »

There is no such thing as a negative (virtual or not) address. That address range is expressed as hexadecimal unsigned numbers.
markq
Posts: 24
Joined: Fri Jan 30, 2015 3:42 pm

Re: How to map to 0xffffffff80000000 - -> 0xffffffffffffffff

Post by markq »

kzinti wrote:There is no such thing as a negative (virtual or not) address. That address range is expressed as hexadecimal unsigned numbers.
Hi,

I can see that it's address expressed as hexadecimal unsigned number, but even with PML4 I can only map 256 TB and not enough to reach 0xffffffff80000000. If I want to map to 0xffffffff80000000 which entrie(s) should I fill in the PML4 table?
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:

Re: How to map to 0xffffffff80000000 - -> 0xffffffffffffffff

Post by Combuster »

markq wrote:not enough to reach 0xffffffff80000000.
The second half of PML4 maps the last TBs of virtual memory. You actually can't map the middle addresses, but 0xffffffffffffffff is perfectly fine.
"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 ]
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: How to map to 0xffffffff80000000 - -> 0xffffffffffffffff

Post by JAAman »

btw:
this is explained in the Intel 1:3.3.7

Its not often I refer to volume 1, but it doesn't seem to be mentioned in 3... though it is shown in the figures accompanying 3A:3.10.1 & 3.10.2 (and referred to without explanation in 3A:5.15.13 -- the chapter 5 section describing #GP)
Post Reply