From: ysht on 5 Jul 2010 04:11 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!
From: Maxim S. Shatskih on 5 Jul 2010 15:32 > 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 maxim(a)storagecraft.com http://www.storagecraft.com
From: ysht on 5 Jul 2010 22:44 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. >
From: Pavel Lebedinsky [MSFT] on 6 Jul 2010 00:56 > 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.
From: ysht on 6 Jul 2010 02:06 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. >
|
Pages: 1 Prev: user buffer question Next: Filtering floppy operations with minifilter driver |