views:

419

answers:

2

I have a Vista x64 machine with 6GB of RAM, and I'm attempting to test that a device driver functions properly when doing DMA to physical addresses above 4GB.

I've found the AllocationPreference registry key, which is supposed to "force allocations to allocate from higher addresses before lower addresses", but the page isn't clear whether this affects physical addresses or only virtual addresses. Based on the behavior of my code, I suspect it is only affecting virtual addresses.

I've also come across the nolowmem boot option, which is supposed to load "the operating system, device drivers, and all applications into addresses above the 4 GB boundary," but it seems to only be for 32-bit versions of Windows. I tried enabling on Vista x64, but the machine wouldn't boot up. I just set up this machine a couple of days ago, so it didn't have any service packs; I'm currently installing those to see if this is due to a Windows bug.

Is there any way to force Windows to allocate virtual addresses above 4GB backed by physical addresses above 4GB?

A: 

See: http://stackoverflow.com/questions/1156271/any-way-to-allocate-physical-memory-above-4gb-on-vista-x64/1156415#1156415

and ignore my previous answer here.

MSN
I don't think this is useful advise. Did you actually try that advise in your own device driver, with success?
Martin v. Löwis
Duh. Allocating > 4GB only guarantees that at least one virtual address is backed by physical memory > 4GB, but you can't determine which one it is.
MSN
+3  A: 

Try MmAllocateContiguousMemorySpecifyCache.

Martin v. Löwis
I might use that. However, it looks like updating the machine to SP2 allows it to boot with NOLOWMEM on, and task manager only reports 1.6 GB of physical memory available. So I'm going to do a bit of testing with this first.
mmebane