Re: The need to call MmProbeAndLockPages

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Maybe ->AllocateCommonBuffer will fit better? It knows about the possible
PCI bridges and apertures before your device, and
MmAllocateContiguousMemorySpecifyCache does not.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@xxxxxxxxxxxxxxxx
http://www.storagecraft.com

"Daniel" <Daniel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:799C15B7-C15A-4D6E-9F08-66CFB368471A@xxxxxxxxxxxxxxxx
> Thanks for your response.
> You are right. If the memory is shared localy, I do not need to allocate a
> contiguous memory. However, The driver is a driver for a PCI bridge chip to
> map the memories of a system and a subsystem across the PCI Bridge.
> Each system allocates a contiguous memory using
> MmAllocateContiguousMemorySpecifyCache. The driver on each system uses
> MmMapIoSpace to map the other side memory through a PCI BAR using one
> physical address.
>
> --
> Thanks,
>
> Daniel
>
>
> "Maxim S. Shatskih" wrote:
>
> > > If a driver allocates memory using
> > >MmAllocateContiguousMemorySpecifyCache,
> >
> > For what? This function is intended for DMA adapter objects implementors
only -
> > like the AGP GART drivers.
> >
> > Usual drivers should use ->AllocateCommonBuffer instead, if this is for DMA
and
> > "contiguous" is really need. Otherwise, use ExAllocatePoolWithTag.
> >
> > > does the driver need to call MmProbeAndLockPages before calling
> > > MmMapLockedPagesSpecifyCache to get a user space virtual address? I
> >
> > Exposing kernel memory to user mode is a very bad idea. Better to do vice
> > versa - allocate in user, lock and map in kernel.
> >
> > > Also, If a driver maps a PCI memory BAR using MmMapIoSpace, does the
> > >driver
> > > need to call MmProbeAndLockPages before calling
> > >MmMapLockedPagesSpecifyCache
> >
> > No need at all.
> >
> > --
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > maxim@xxxxxxxxxxxxxxxx
> > http://www.storagecraft.com
> >
> >

.



Relevant Pages