How to access physical memory > 4GB on 32 bit

xxxxx@gmail.com wrote:

Now let me summarize what i have understood:

Again i will take the previous scenario:
my machine has 16 GB of RAM. Windows 2000
Advanced Server is installed which supports upto 8 GB of physical memory. And
the OS is currently using 6 GB of physical memory out of the supported 8 GB.

  1. There is no method by which i can access physical memory above the OS supported 8 GB PURELY in kernel mode (i mean without any user app).

No, this is not correct. The memory certainly exists, and it has a
physical address. You can treat it just like a chunk of memory sitting
on a PCI card, and use something like MmMapIoSpace. The problem is that
there is no documented method for finding out at exactly what physical
address this orphaned memory starts. Don Burn has suggested that you
can fetch the memory range resources, and start just after the largest
physical address in that range.

  1. However, the physical memory above the supported 8 GB mark can be mapped in using AWE APIs in user mode. And then passed to kernel mode for use.

Is there any special reason for this behaviour of supporting it from user mode & not from kernel mode?

Kernel code is supposed to support devices, and the kernel APIs support
that. User mode is supposed to be where the real work is done – where
the rubber meets the road. Too many people try to do user stuff in
kernel mode, just because it is more interesting or more fun.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

xxxxx@hotmail.com wrote:

> To access the OS-invisible memory, MmMapIoSpace of its physical address
> is the only chance.
>

Indeed, MmMapIoSpace() does not seem to care if the physical range itself is valid.

Of course, because there is no such thing as an “invalid physical
range”. Every physical address is potentially legitimate. The
processor had to put every physical address reference onto its bus
lines, because some device somewhere might be ready and willing to
respond to it.

You cannot “validate” physical addresses. Only virtual addresses.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> Of course, because there is no such thing as an “invalid physical range”.

What about those ranges that are marked as reserved by BIOS??? As far as the OS is concerned, this range just does not exist, so that, from the OS’s perspective, it is invalid.

Every physical address is potentially legitimate.

This is true. However, it does not necessarily imply that the OS is able to reference any address - it has to respect the memory map that BIOS provides…

Anton Bassov

Just to keep this thread kicked - you are not going to have much luck trying
to allocate system ptes for 8gb of memory in kernel mode. At best you might
be able to slide a much smaller mdl based window across that chunk of
memory.

On Feb 7, 2008 2:27 AM, wrote:

> Thank you very much all of you for your help.
> I will try out both the methods.
>
> -Tushar
>
> —
> NTDEV is sponsored by OSR
>
> 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
>


Mark Roddy

xxxxx@hotmail.com wrote:

> Of course, because there is no such thing as an “invalid physical range”.
>

What about those ranges that are marked as reserved by BIOS??? As far as the OS is concerned, this range just does not exist, so that, from the OS’s perspective, it is invalid.

It might not be available for general purpose use, but it is still
valid. What if an OEM driver wants to read that memory? That’s a
perfectly reasonable desire.

> Every physical address is potentially legitimate.
>

This is true. However, it does not necessarily imply that the OS is able to reference any address - it has to respect the memory map that BIOS provides…

I disagree. The OS can reference any physical address it wants to. It
can’t dole out that memory for other uses, but it’s still a valid range.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> It might not be available for general purpose use, but it is still valid.

If we are speaking about the reserved range(consider BIOS as an example), this is true. However, in addition to that, a range may be just plainly invalid, so that cycles to that range are just not decoded (consider a memory hole as an example).

What if an OEM driver wants to read that memory? That’s a perfectly reasonable desire.

Then OEM will make sure that the OS is able to arrive to this range via the Configuration Space, so that it will get passed to a driver as a resource.

The OS can reference any physical address it wants to.

Even if it just does not exist (again, consider a memory hole as an example)???

Anton Bassov

xxxxx@hotmail.com wrote:

> The OS can reference any physical address it wants to.

Even if it just does not exist (again, consider a memory hole as an example)???

Absolutely. Who’s going to stop it? Today, if you read from an address
no one claims, you’ll just get ffffffff (because of pull-ups). I
understand there are some architectures where reading an address with no
responses will cause a bus fault, but it’s still a valid bus cycle.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.