How to find highest physical address ?

Hello

I have win10x64 test pc with 2Gb RAM installed. But physical memory references above 2gb still happening (for example local APIC registers mapped to physical address starting at FEE00000H). I tried to query \Registry\Machine\Hardware\ResourceMap\System Resources\Physical Memory\.Translated with following results:

start: 1000 end: 9c000
start: 100000 end: 102000
start: 103000 end: 2d8000
start: 39d000 end: 7727c000
start: 77282000 end: 773ed000
start: 7740f000 end: 7746f000
start: 7770f000 end: 77717000
start: 7771f000 end: 7777f000
start: 7779f000 end: 777e1000
start: 777ff000 end: 77800000

I also checked SMBIOS info (AuxKlibGetSystemFirmwareTable) for Memory Array Mapped Address (Type 19) and Memory Device Mapped Address (Type 20):

memory array : start: 0 end: 7ffffc00
memory device: start: 0 end: 0
memory device: start: 0 end: 7ffffc00

For now I use cpuid leaf 80000008H, but this is definitely an overkill. Is there some way to find out maximum physical address ? Msinfo32 somehow knows about memory ranges above 2gb (msinfo32->Hardware Resources->Memory):
0xFF000000-0xFFFFFFFF Motherboard resources OK
0xFF000000-0xFFFFFFFF Legacy device OK

Well, you’ve got only 2G of RAM, so I don’t really understand why you are so surprised that you don’t get any references to anything above it (i.e. to non-existent RAM)…

But physical memory references above 2gb still happening (for example local APIC
registers mapped to physical address starting at FEE00000H).

It is understandable that you are getting the references to memory-mapped registers like APIC registers, device BARs, FIFOs,etc. However, these are totally unrelated to RAM, and, hence, are not going to show up in the results of functions that deal with physical memory maps.If you were doing this at the boot stage by calling the firmware functions, you would still get exactly the same results, because memory-mapped registers don’t show up on the memory map that firmware returns. Taking into account that all the OS functions that you call rely upon above mentioned map that the OS gets from the firmware at the boot stage, there is nothing particularly strange about the results that you get…

Anton Bassov

On Sep 3, 2018, at 1:45 AM, xxxxx@gmail.com wrote:
>
> I have win10x64 test pc with 2Gb RAM installed. But physical memory references above 2gb still happening (for example local APIC registers mapped to physical address starting at FEE00000H). I tried to query \Registry\Machine\Hardware\ResourceMap\System smb: Resources\Physical Memory\.Translated with following results:
> …
> For now I use cpuid leaf 80000008H, but this is definitely an overkill. Is there some way to find out maximum physical address ?

Well, wait a minute. You have mentioned two different things here – physical memory, and physical address space. There are a lot more things in the physical address space than just memory. All of your cards and device registers are mapped into physical address regions that don’t have memory.

> Msinfo32 somehow knows about memory ranges above 2gb (msinfo32->Hardware Resources->Memory):
> 0xFF000000-0xFFFFFFFF Motherboard resources OK
> 0xFF000000-0xFFFFFFFF Legacy device OK

Those things are not memory. Those are registers mapped into the physical address space. There is no “upper limit” to physical address space, other than FFFFFFFF_FFFFFFFF.

Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.</smb:>

I understand that this is not a real ram. It doesn’t matter to me though. For me it’s just the same memory reference.

I believe physical memory space limited by number of address lines. You can’t reference physical address 0xff00000000000000 if cpu only has 36 address lines. And cpuid gives me exactly that - theoretical limit.

I want to know the actual ranges of “memory” used by os and hardware.

Msinfo32 somehow knows about this ranges, so there should be a way to get that information.

Sent from my iPhone

On 4 Sep 2018, at 05:39, xxxxx@probo.com wrote:
>
>> On Sep 3, 2018, at 1:45 AM, xxxxx@gmail.com wrote:
>>
>> I have win10x64 test pc with 2Gb RAM installed. But physical memory references above 2gb still happening (for example local APIC registers mapped to physical address starting at FEE00000H). I tried to query \Registry\Machine\Hardware\ResourceMap\System Resources\Physical Memory\.Translated with following results:
>> …
>> For now I use cpuid leaf 80000008H, but this is definitely an overkill. Is there some way to find out maximum physical address ?
>
> Well, wait a minute. You have mentioned two different things here – physical memory, and physical address space. There are a lot more things in the physical address space than just memory. All of your cards and device registers are mapped into physical address regions that don’t have memory.
>
>
>> Msinfo32 somehow knows about memory ranges above 2gb (msinfo32->Hardware Resources->Memory):
>> 0xFF000000-0xFFFFFFFF Motherboard resources OK
>> 0xFF000000-0xFFFFFFFF Legacy device OK
>
>
> Those things are not memory. Those are registers mapped into the physical address space. There is no “upper limit” to physical address space, other than FFFFFFFF_FFFFFFFF.
> —
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

> For me it???s just the same memory reference.

Probably, for you, but not for the OS - the OS knows that it has to get this info from the different sources.

Concerning physical RAM ranges, it gets the info from the memory map that the bootloader get from the firmware at the boot stage. Concerning memory-mapped BARs, it gets the info about them from PCI configuration space. Some info (like APIC registers) is sort of “hard-wired” - the OS just knows in advance that it has to find the CPUs locals APICs at the fixed address 0xFEC00000, so that this address does not even refer to some unique location/entity…

Anton Bassov