Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > MmMapLockedPagesSpecifyCache in XP and Server2003

Reply
Thread Tools Display Modes

MmMapLockedPagesSpecifyCache in XP and Server2003

 
 
ysht
Guest
Posts: n/a

 
      07-05-2010
Hi,
I'm Yot and I'm writing a driver.

Here is my driver code:
===
DeviceExtension->SystemVirtualAddress = ExAllocatePool( NonPagedPool , Size6M );
DeviceExtension->Mdl = IoAllocateMdl( DeviceExtension->SystemVirtualAddress,
Size6M, FALSE, FALSE, NULL );
DeviceExtension->UserVirtualAddress = MmMapLockedPagesSpecifyCache(
DeviceExtension->Mdl,
UserMode, MmNonCached, NULL,
FALSE, NormalPagePriority);
===

This code code works well in WindowsXP Professional Version 2002 SP3.
(MmMapLockedPagesSpecifyCache returns non-NULL value.)

But in Windows Server 2003 R2 Standard Edition SP3,
MmMapLockedPagesSpecifyCache returns NULL.

Therefore I use WindowsXP,but want to actually Windows Server 2003 now.

Can anyone provide suggestions ?
Any help or guidance would be appreciated.

Thanks!


 
Reply With Quote
 
 
 
 
Maxim S. Shatskih
Guest
Posts: n/a

 
      07-05-2010
> But in Windows Server 2003 R2 Standard Edition SP3,
> MmMapLockedPagesSpecifyCache returns NULL.


So what? you're out of system PTEs, just handle such a thing properly.

--
Maxim S. Shatskih
Windows DDK MVP

http://www.storagecraft.com

 
Reply With Quote
 
ysht
Guest
Posts: n/a

 
      07-06-2010
Thanks,Maxim.

Could you answer one more ?

Did you mean that MmMapLockedPagesSpecificCache failed
(returned NULL) for lack of system PTEs ?


Yot.

(2010/07/06 4:32), Maxim S. Shatskih wrote:
>> But in Windows Server 2003 R2 Standard Edition SP3,
>> MmMapLockedPagesSpecifyCache returns NULL.

>
> So what? you're out of system PTEs, just handle such a thing properly.
>


 
Reply With Quote
 
Pavel Lebedinsky [MSFT]
Guest
Posts: n/a

 
      07-06-2010
> DeviceExtension->SystemVirtualAddress = ExAllocatePool( NonPagedPool ,
> Size6M );
> DeviceExtension->Mdl = IoAllocateMdl(
> DeviceExtension->SystemVirtualAddress,
> Size6M, FALSE, FALSE, NULL );
> DeviceExtension->UserVirtualAddress = MmMapLockedPagesSpecifyCache(
> DeviceExtension->Mdl,
> UserMode, MmNonCached, NULL,
> FALSE, NormalPagePriority);
> ===
>
> This code code works well in WindowsXP Professional Version 2002 SP3.
> (MmMapLockedPagesSpecifyCache returns non-NULL value.)
>
> But in Windows Server 2003 R2 Standard Edition SP3,
> MmMapLockedPagesSpecifyCache returns NULL.



Two problems here:

1. You need to call MmBuildMdlForNonPagedPool before attempting to
map the pages.

2. Nonpaged pool memory is fully cached, and mapping it as MmNonCached
is not allowed. You need to either a) use MmCached when mapping the MDL,
or b) if you really need a non-cached mapping, use
MmAllocatePagesForMdlEx (instead of ExAllocatePool) to allocate pages
with the MmNonCached attribute.

--
Pavel Lebedinsky/Windows Fundamentals Test
This posting is provided "AS IS" with no warranties, and confers no rights.


 
Reply With Quote
 
ysht
Guest
Posts: n/a

 
      07-06-2010
Pavel,Thanks a lot.

I will take your advice into account and try it.

Thank you very much.
(Pavel-san,domo arigatou.)

Yot.

(2010/07/06 13:56), Pavel Lebedinsky [MSFT] wrote:
>> DeviceExtension->SystemVirtualAddress = ExAllocatePool( NonPagedPool ,
>> Size6M );
>> DeviceExtension->Mdl = IoAllocateMdl(
>> DeviceExtension->SystemVirtualAddress,
>> Size6M, FALSE, FALSE, NULL );
>> DeviceExtension->UserVirtualAddress = MmMapLockedPagesSpecifyCache(
>> DeviceExtension->Mdl,
>> UserMode, MmNonCached, NULL,
>> FALSE, NormalPagePriority);
>> ===
>>
>> This code code works well in WindowsXP Professional Version 2002 SP3.
>> (MmMapLockedPagesSpecifyCache returns non-NULL value.)
>>
>> But in Windows Server 2003 R2 Standard Edition SP3,
>> MmMapLockedPagesSpecifyCache returns NULL.

>
>
> Two problems here:
>
> 1. You need to call MmBuildMdlForNonPagedPool before attempting to
> map the pages.
>
> 2. Nonpaged pool memory is fully cached, and mapping it as MmNonCached
> is not allowed. You need to either a) use MmCached when mapping the MDL,
> or b) if you really need a non-cached mapping, use
> MmAllocatePagesForMdlEx (instead of ExAllocatePool) to allocate pages
> with the MmNonCached attribute.
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access to a shared folder in Server2003 SIS01 Windows Server 1 06-24-2010 09:51 PM
Re: Server2003 2008 error !! Paul Bergson [MVP-DS] Active Directory 0 11-27-2009 12:19 PM
Re: Server2003 2008 error !! Meinolf Weber [MVP-DS] Active Directory 0 11-26-2009 01:37 PM
Re: Problem with one-way sync for Outlook2003 data on Windows Server2003 Rob Borek [MS MVP] ActiveSync 0 02-04-2005 03:24 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59