Physical Memory

Hi all

I know this might be a stupid question but please bear with me…

I’ve been writing a driver that requires DMA - fair enough - but I haven’t
been able to get it to work using the appropriate ‘new model’ functions -
fair enough.
I have spent the last few days boiling down the code to try and figure out
what is going on and I have reached an impass.

Basically, for debugging purposes, I have allocated a single 4096 byte page
of memory using AllocateCommonBuffer (and a variety of other ways including
ExAllocatePool (nonpaged) with MmGetPhysicalAddress (shhh, don’t tell
anyone - it’s only for debugging) ). I have this utility that purports to
allow the inspection of physical memory on the computer - and you can read
register maps of devices and other things quite nicely, but for some reason
it just cannot see this block of memory via its physical address.

It’s possible this utility just does not work, but it’s the only straw I can
find to clutch at. It is more likely that there is something fundamental
about physical memory that I don’t understand and it is the cause of all my
problems.

Any ideas?

Thanks

Phil

Phil,

You can read physical memory using WinDBG with the command “!dd [cachemode]
physaddr”. Cachemode is [c] for “cached”, [uc] for “uncached” and [wc] for
“writecombined”. For DMA buffers you can use any caching, but you need to
use the correct settings as to what you’ve mapped the memory as, otherwise
the processor may do stupid things (if you read uncachable memory into the
cache, the memory may later on be written back from the cache, which can
cause problems if the external memory has changed since it was last read).

There’s also a !ed command for writing to a physical address.


Mats

xxxxx@lists.osr.com wrote on 01/20/2005 10:35:07 AM:

Hi all

I know this might be a stupid question but please bear with me…

I’ve been writing a driver that requires DMA - fair enough - but I
haven’t
been able to get it to work using the appropriate ‘new model’ functions -
fair enough.
I have spent the last few days boiling down the code to try and figure
out
what is going on and I have reached an impass.

Basically, for debugging purposes, I have allocated a single 4096 byte
page
of memory using AllocateCommonBuffer (and a variety of other ways
including
ExAllocatePool (nonpaged) with MmGetPhysicalAddress (shhh, don’t tell
anyone - it’s only for debugging) ). I have this utility that purports
to
allow the inspection of physical memory on the computer - and you can
read
register maps of devices and other things quite nicely, but for some
reason
it just cannot see this block of memory via its physical address.

It’s possible this utility just does not work, but it’s the only straw I
can
find to clutch at. It is more likely that there is something fundamental
about physical memory that I don’t understand and it is the cause of all
my
problems.

Any ideas?

Thanks

Phil


Questions? First check the Kernel Driver FAQ at http://www.
osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@3dlabs.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

ForwardSourceID:NT0000B38E

Mats

Thanks for that. Using the dd command proved that the utility I was using
is not working properly. I’m finally making progress.

Cheers

Phil
“Mats PETERSSON” wrote in message
news:xxxxx@ntdev…
>
>
>
>
>
> Phil,
>
> You can read physical memory using WinDBG with the command “!dd
[cachemode]
> physaddr”. Cachemode is [c] for “cached”, [uc] for “uncached” and [wc] for
> “writecombined”. For DMA buffers you can use any caching, but you need to
> use the correct settings as to what you’ve mapped the memory as, otherwise
> the processor may do stupid things (if you read uncachable memory into the
> cache, the memory may later on be written back from the cache, which can
> cause problems if the external memory has changed since it was last read).
>
> There’s also a !ed command for writing to a physical address.
>
> –
> Mats
>
> xxxxx@lists.osr.com wrote on 01/20/2005 10:35:07 AM:
>
> > Hi all
> >
> > I know this might be a stupid question but please bear with me…
> >
> > I’ve been writing a driver that requires DMA - fair enough - but I
> haven’t
> > been able to get it to work using the appropriate ‘new model’
functions -
> > fair enough.
> > I have spent the last few days boiling down the code to try and figure
> out
> > what is going on and I have reached an impass.
> >
> > Basically, for debugging purposes, I have allocated a single 4096 byte
> page
> > of memory using AllocateCommonBuffer (and a variety of other ways
> including
> > ExAllocatePool (nonpaged) with MmGetPhysicalAddress (shhh, don’t tell
> > anyone - it’s only for debugging) ). I have this utility that purports
> to
> > allow the inspection of physical memory on the computer - and you can
> read
> > register maps of devices and other things quite nicely, but for some
> reason
> > it just cannot see this block of memory via its physical address.
> >
> > It’s possible this utility just does not work, but it’s the only straw I
> can
> > find to clutch at. It is more likely that there is something
fundamental
> > about physical memory that I don’t understand and it is the cause of all
> my
> > problems.
> >
> > Any ideas?
> >
> > Thanks
> >
> > Phil
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at http://www.
> > osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@3dlabs.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> > ForwardSourceID:NT0000B38E
>
>