MmGetPhysicalAddress is returning an address above 4G in a machine with only 4G of RAM installed. Windows 7 64-bit. How can this be happening? I have heard of it happening on 32-bit systems with PAE enabled but 64-bit has no PAE. Any ideas?
Thanks
The physical addresses between 3 and 4 GB are reserved for PCI(e) devices. The memory which would occupy that is remapped by the chipset above 4GB. This is why a 32bit client cannot use the full 4GB.
Why do you care, anyway? You MUST support full 64 bit physical address.
Depending on the chipset, there is no guarantee that the main memory address
space start at any particular value nor be continuous and in high end
systems, it can even change dynamically when hot-plug memory is added. The
OS handles this all for you (or doesn’t as the case may be), so you can’t
and shouldn’t worry about it.
wrote in message news:xxxxx@ntdev…
MmGetPhysicalAddress is returning an address above 4G in a machine with only
4G of RAM installed. Windows 7 64-bit. How can this be happening? I have
heard of it happening on 32-bit systems with PAE enabled but 64-bit has no
PAE. Any ideas?
Thanks
You do realize, right, that MmGetPhysicalAddress is returning the physical address, and that physical addresses are the same regardless of whether the machine is running in 64-bit or 32-bit PAE mode, right?
The physical address layout of the machine is never contiguous, and there are non-RAM things that must appear below the 4GB line. Thus some memory in a 4GB machine will be pushed above the 4GB line.
- Jake Oshins
Microsoft
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@boeing.com
Sent: Tuesday, October 15, 2013 1:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] MmGetPhysicalAddress with 4G physical ram
MmGetPhysicalAddress is returning an address above 4G in a machine with only 4G of RAM installed. Windows 7 64-bit. How can this be happening? I have heard of it happening on 32-bit systems with PAE enabled but 64-bit has no PAE. Any ideas?
Thanks
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Actually, the exact memory map varies from machine to machine. Sometimes it’s 3.6GB to 4GB that’s in use for non-RAM stuff. Sometimes it’s 2GB to 4GB.
- Jake
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@broadcom.com
Sent: Tuesday, October 15, 2013 3:24 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] MmGetPhysicalAddress with 4G physical ram
The physical addresses between 3 and 4 GB are reserved for PCI(e) devices. The memory which would occupy that is remapped by the chipset above 4GB. This is why a 32bit client cannot use the full 4GB.
Why do you care, anyway? You MUST support full 64 bit physical address.
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
> Why do you care, anyway?
Well, apparently because some people just have natural in-born intelligence and curiosity. Whenever someone like that encounters something that he/she cannot immediately explain he/she starts wondering WHY it happens this way. People of this type are naturally born for the things like science, R&D and UNIX programming. Programming in Windows environment where experimentation is strongly discouraged and “don’t ask and do as you are told to” attitude is promoted is obviously not the right thing for them…
Anton Bassov
> The OS handles this all for you
Actually, when it comes to the physical memory the OS software is in exactly the same position as
anyone else - it has no means to evaluate it and has to rely upon the memory map provided by BIOS…
Anton Bassov
There is nothing in the least surprising about this. There are two
choices if you have 4GB of physical memory installed: various reserved
parts of the memory map are partitioned out, and in terms of available
RAM, you will end up with less than 4GB available. OR, the physical bus
address can be more than 32 bits, so while the reserved sections are
mapped out, the space they occupied are mapped to something above 4GB.
The problem arises when your DMA engine cannot support physical addresses
greater than 32 bits. In that case, you would mark your device as
incapable of supporting more than 32 bits, and the OS would handle this by
some form of mapping, such as reserving bounce buffers in the lower 4GB of
memory.
joe
Depending on the chipset, there is no guarantee that the main memory
address
space start at any particular value nor be continuous and in high end
systems, it can even change dynamically when hot-plug memory is added.
The
OS handles this all for you (or doesn’t as the case may be), so you can’t
and shouldn’t worry about it.wrote in message news:xxxxx@ntdev…
MmGetPhysicalAddress is returning an address above 4G in a machine with
only
4G of RAM installed. Windows 7 64-bit. How can this be happening? I
have
heard of it happening on 32-bit systems with PAE enabled but 64-bit has no
PAE. Any ideas?
Thanks
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminarsTo unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
64-bit probably has a 40-bit memory bus, so doesn’t need PAE. See my
earlier reply. Don’t confuse kludges that let 32-bit DMA engines access
high memory with 64-bit systems. If your DMA engine can only support
32-bit addresses, the OS will handle this for you. If you are getting >
32 bits, you may have misconfigured your DMA configuration by saying your
device could handle 64-bit DMA.
joe
MmGetPhysicalAddress is returning an address above 4G in a machine with
only 4G of RAM installed. Windows 7 64-bit. How can this be happening?
I have heard of it happening on 32-bit systems with PAE enabled but 64-bit
has no PAE. Any ideas?
Thanks
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminarsTo unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
> 64-bit probably has a 40-bit memory bus, so doesn’t need PAE. See my earlier reply. Don’t confuse
kludges that let 32-bit DMA engines access high memory with 64-bit systems.
Well, the OP seems to be confusing physical and virtual memory when he speaks about PAE in this context. Although PAE, indeed, allows you to access physical addresses above 4G it is VM -related thing. In fact, this is just an extra layer of indirection in page table hierarchy that allows 32-bit CPU to access physical addresses of up to 2^36 bytes…
Anton Bassov
You should not use this API at all, use DMA APIs instead.
–
Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com
wrote in message news:xxxxx@ntdev…
> MmGetPhysicalAddress is returning an address above 4G in a machine with only 4G of RAM installed. Windows 7 64-bit. How can this be happening? I have heard of it happening on 32-bit systems with PAE enabled but 64-bit has no PAE. Any ideas?
> Thanks
>
Thanks for the replies. I figured this would be the place to get the correct answer. I was unaware that chipsets could remap memory above the 4G mark. Why do I ask? Engineers are naturally curious when they see something they don’t quite understand.
Cheers
And to make things more confusing. amd64 and intel_x86-64 long mode
requires enabling PAE and PG. “Long mode with no MMU” doesn’t exists (yet).
On Wed, Oct 16, 2013 at 3:19 AM, wrote:
> > 64-bit probably has a 40-bit memory bus, so doesn’t need PAE. See my
> earlier reply. Don’t confuse
> > kludges that let 32-bit DMA engines access high memory with 64-bit
> systems.
>
> Well, the OP seems to be confusing physical and virtual memory when he
> speaks about PAE in this context. Although PAE, indeed, allows you to
> access physical addresses above 4G it is VM -related thing. In fact, this
> is just an extra layer of indirection in page table hierarchy that allows
> 32-bit CPU to access physical addresses of up to 2^36 bytes…
>
>
> Anton Bassov
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Some BIOS has a name for this option, i.e. “Memory hole Remapping”. but
it’s not useful to windows 32 bit OS because msft doesn’t like PAE on their
32-bit os.
On Wed, Oct 16, 2013 at 8:11 AM, wrote:
> Thanks for the replies. I figured this would be the place to get the
> correct answer. I was unaware that chipsets could remap memory above the
> 4G mark. Why do I ask? Engineers are naturally curious when they see
> something they don’t quite understand.
> Cheers
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> And to make things more confusing. amd64 and intel_x86-64 long mode requires enabling PAE and PG.
“Long mode with no MMU” doesn’t exists (yet).
Actually, there is nothing confusing here…
Before you are in a position to enable paging (which applies to 32-bit-no-PAE, 32-bit-PAE and 64-bit mode)
you have to set up a page directory and page tables. This is what 32-bit protected mode without paging is for - you enter it, and then set up page directory and tables in such a way that results in identical mapping, i.e.going through page-table translation mechanism yields exactly the same physical address as the virtual one that has been translated. At this point you are already in a position to enable paging.
There is simply no need for 64-bit mode without paging, because the range of addresses you may want to access without paging is tiny…
Anton Bassov
One of the fascinating problems I had to address back in 1969 or so was
booting a mainframe in “real” mode, then making it go virtual. This is a
pretty nontrivial operation, because at the point where you set the
“virtual mode” bit, a whole lot of stuff has to be “just perfect” or your
virtual mode will take some impossible sequenceof errors which are going
to be next to impossible to debug. While the rest of the class designed
the scheduler, program loader, and other components, I wrote the code that
started at the boot image and went to the first virtual mode transition.
After that, it was someone else’s problem. We wrote the OS in FORTRAN (!)
because it was the only compiler which did not rely on a massive runtime
library (our other choice was PL/1, and we did not consider assembler as
viable for a one-semester project when the class had only two-of-thirty
who had a clue as to how to program at that level). We got enough working
that we all got a passing grade. I used the same trick: I made a VM map
that was 1:1 with physical memory, then “went virtual” with no apparent
code transition. The VM team never got paging to work right (or at all),
and they had the other assembly expert on their team because the
page-fault ISR had to be in assembler (his part worked, but not much else
did in the paging system). Part of the trick on te 360/67 was that the
virtual Program Status Word had adifferent layout than the real-mode PSW,
as defined by the “virtual” bit, so the new, virtual PSW had to not only
have the virtual bit set, but all the other bits had to work right, too,
including the IP (32 bits in virtual mode, 24 bits in real mode) which
limited the physical addresses we could use for the boot.
Every hardware platform I’ve seen since has had a similarly delicate
dance. Perhaps the single worst one was the 286 chip, whose transition to
virtual mode was monotonic–once you went virtual, it was impssible to go
back to real mode again. At a conference, one of the attendees asked what
I thought about the 286. My comment was that it had either been deigned
by a pure academic, or by a recent graduate who had trusted his hardware
professor’s opinions too much. He was deeply offended; he said “he was my
best student in the hardware architecture course” and blamed everything on
Microsoft not understanding the elegance of the architecture. (To go to
real mode, you wrote a staus bit to the CMOS clock chip, then forced a
reboot by writing a status bit to another register, which entered the
reboot logic. The low-level boot start checked the status bit in the CMOS
clock chip, and if it was set, recognized this as a kernel call, but the
reboot was the only way to get te chip back to real mode. Which was
required for doing I/O). What makes Windows cool is that it never has to
revert to real mode in all but the most extreme cases, such as an actual
reboot).
The transitions are not “confusing”, but the phrases “delicate” and
“extremely carefully sequenced” are good descriptions.
joe
> And to make things more confusing. amd64 and intel_x86-64 long mode
> requires enabling PAE and PG.
> “Long mode with no MMU” doesn’t exists (yet).Actually, there is nothing confusing here…
Before you are in a position to enable paging (which applies to
32-bit-no-PAE, 32-bit-PAE and 64-bit mode)
you have to set up a page directory and page tables. This is what 32-bit
protected mode without paging is for - you enter it, and then set up page
directory and tables in such a way that results in identical mapping,
i.e.going through page-table translation mechanism yields exactly the
same physical address as the virtual one that has been translated. At this
point you are already in a position to enable paging.There is simply no need for 64-bit mode without paging, because the range
of addresses you may want to access without paging is tiny…Anton Bassov
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminarsTo unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer