My hardware people have this need for their diagnostics program. I have added a driver API where the diag can ask for a contiguous buffer, which they use to do dma “by hand”, that is, accessing the chip registers directly. My driver allocates a sizable slab of contiguous kernel memory at start time (its size is configurable through a registry entry), so that when I get this diag request I suballocate a buffer, get an mdl for it, and map it in user visibility so that the diag program can access it.
I have a similar piece of functionality that allows the diag program to ask for a mapping for the chip’s BAR registers’ address ranges.
This is rather dirty functionality, and we do not want our users to have access to it, so, we surround it with some safety valves to make sure that only the diag program can access it. We have been mulling, on and off, about moving all that dirty functionality to a diag filter driver, which wouldn’t be distributed to our users.
Note that the MmAllocateContiguousMemory requires the highest acceptable physical address, which doesn’t need to be the highest machine address. You can restrict it to a low value, for example, if you’re doing a stress test, but my experience is that I can set it to all Fs without much of a problem. However, there are Microsoft people in this list who can shed more light on this issue!
Hope this helps,
Alberto.
----- Original Message -----
From: Mark Roddy
To: Windows System Software Devs Interest List
Sent: Wednesday, December 05, 2007 3:09 PM
Subject: Re: [ntdev] Accessing OS’s highest Physical memory
Well that seems rather problematic for many reasons, but your answer does not answer the question “why do you need the highest physical address”?
Applications should not be reserving physical memory at all. The OS reserves physical memory, and provides kernel interfaces for doing so. “reserved physical memory for dma operations” would be one definition of what the Windows OS refers to as a “Common Buffer”. Perhaps that is what you actually need, you should acquire it in your driver when your device is loaded, and not attempt to have an application perform this sort of task.
On Dec 5, 2007 2:43 PM, wrote:
Hi,
I’m trying to reserve a portion of physical memory for DMA transfers. I’m doing this through my application. In order to do this I need the OS’s highest Physical address. So far I haven’t found a way to retrieve this and decipher the .Translated value.
Thanks.
—
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 — 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