Physical Address Lock

Hello
My Device is an ACPI device,
my driver reads some Physical address via the device registers (I have memory map area to the registers).
My Driver need to work with this Physical address so I use MmMapIoSpace() and its works fine and I’m able to work with this area to communicate with my device. (this address is reserved by the ACPI/BIOS)

my problem is with Driver Verifier.
I’m getting Bug check 0xC4 with 0x83 Param1

from MSDN (http://msdn.microsoft.com/en-us/library/windows/hardware/ff560187(v=VS.85).aspx):

" The driver called MmMapIoSpace without having locked down the MDL pages. The physical pages represented by the physical address range being mapped must have been locked down prior to making this call."

I searched the web and forums but I didn’t find a way to lock the physical address.
what is the solution in this case?

Thanks in advance

This means the physical range you’re trying to map wasn’t actually reserved by the BIOS, so the memory manager is treating it like regular RAM.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, December 27, 2011 11:53 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Physical Address Lock

Hello
My Device is an ACPI device,
my driver reads some Physical address via the device registers (I have memory map area to the registers).
My Driver need to work with this Physical address so I use MmMapIoSpace() and its works fine and I’m able to work with this area to communicate with my device. (this address is reserved by the ACPI/BIOS)

my problem is with Driver Verifier.
I’m getting Bug check 0xC4 with 0x83 Param1

from MSDN (http://msdn.microsoft.com/en-us/library/windows/hardware/ff560187(v=VS.85).aspx):

" The driver called MmMapIoSpace without having locked down the MDL pages. The physical pages represented by the physical address range being mapped must have been locked down prior to making this call."

I searched the web and forums but I didn’t find a way to lock the physical address.
what is the solution in this case?

Is there a way to me to lock the memory in the driver?
or this need to be fix in the BIOS?

The fix needs to be in the BIOS. Otherwise the memory could be allocated by somebody else before your driver had a chance to allocate/lock it.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, December 27, 2011 12:31 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Physical Address Lock

Is there a way to me to lock the memory in the driver?
or this need to be fix in the BIOS?


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

Thanks for replay.
is there a way to verify it with WinDbg.

You can dump memory manager’s view of what memory ranges are available:

lkd> dt nt!_PHYSICAL_MEMORY_DESCRIPTOR poi(nt!MmPhysicalMemoryBlock)
+0x000 NumberOfRuns : 3
+0x008 NumberOfPages : 0x1fef39
+0x010 Run : [1] _PHYSICAL_MEMORY_RUN

lkd> dt nt!_PHYSICAL_MEMORY_DESCRIPTOR poi(nt!MmPhysicalMemoryBlock) Run[0].
+0x010 Run : [0]
+0x000 BasePage : 1
+0x008 PageCount : 0x94

lkd> dt nt!_PHYSICAL_MEMORY_DESCRIPTOR poi(nt!MmPhysicalMemoryBlock) Run[1].
+0x010 Run : [1]
+0x000 BasePage : 0x100
+0x008 PageCount : 0xeeea5

Etc.

Each PHYSICAL_MEMORY_RUN describes a range of regular RAM. Ranges excluded by the BIOS should be in the gaps between adjacent memory runs.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, December 27, 2011 10:17 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Physical Address Lock

Thanks for replay.
is there a way to verify it with WinDbg.


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

Are you trying to map the device registers or RAM?
What’s the logical (“physical”) address you’re trying to map?

Might also want to try the !arbiter extension:

!arbiter 1

we are trying to map some RAM.
the address change every boot, the BIOS/ACPI allocate it.

How do you get this address? What value do you get?