The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
Hi from Germany,
since several years our NDIS miniport driver (NDIS Version 6.6) with our NDIS PCIe NIC (DMA busmaster adapter) runs without any problems on Windows machines.
New mainboards with BIOS enabled kernel DMA protection ("enabled" seems to be default) result in a blue screen, when the computer starts and the miniport driver is enabled:
An illegal DMA operation was attempted by a driver being verified.
Arg1: 0000000000000026, IOMMU detected DMA violation.
Arg2: 0000000000000000, Device Object of faulting device.
Arg3: 00000000000c1f80, Faulting information (usually faulting physical address).
Arg4: 0000000000000006, Fault type (hardware specific).
85a6cea8 fffff8027eadab47 : 00000000
000000e6 0000000000000026 00000000
00000000 00000000000c1f80 : nt!KeBugCheckEx
85a6ceb0 fffff8027eac6a6b : 00000000
00000000 0000000000000000 fffff802
7f249dd0 fffff8027f249dd0 : nt!IvtHandleInterrupt+0x1a7
85a6cf10 fffff8027e927f55 : fffff802
7f2f3cc0 fffff80285a5da50 fffff802
7f2f3d70 0000000000000000 : nt!HalpIommuInterruptRoutine+0x4b
85a6cf40 fffff8027e9f75cc : fffff802
85a5da50 fffff8027f2f3cc0 00000000
000007c4 fffff8027e9fc940 : nt!KiCallInterruptServiceRoutine+0xa5
85a6cf90 fffff8027e9f79d7 : fffff802
85a5daf0 0000000000000001 00000000
00040046 fffff8027e870188 : nt!KiInterruptSubDispatchNoLock+0x11c
85a5d9d0 fffff8027e9f977a : 00000000
00000000 0000000000000000 fffff802
7f327600 00000000000007c4 : nt!KiInterruptDispatchNoLock+0x37
85a5db60 0000000000000000 : fffff802
85a5e000 fffff80285a57000 00000000
00000000 0000000000000000 : nt!KiIdleLoop+0x5a
According to the modules list of WinDbg the miniport driver seems to be loaded.
The BSD occurs on Windows 10 and 11 operating systems.
The stop code DRIVER_VERIFIER_DMA_VIOLATION gives a false indication - driver verifier is not (specifically) enabled at the machines!
More info on kernel DMA protection can be found under
Another user has posted on the internet:
"To work around this issue, disable Kernel DMA Protection in BIOS. ... Microsoft is aware of this issue. A resolution will be provided in an upcoming release."
The Microsoft (see link above) writes:
"Windows leverages the system Input/Output Memory Management Unit (IOMMU) to block external peripherals from starting and performing DMA unless the drivers for these peripherals support memory isolation (such as DMA-remapping)."
Our miniport driver allocates memory with the following code:
// Register a DMA channel. !! Necessary, otherwise NdisMAllocateSharedMemory will fail.
dmaDescription.DemandMode = FALSE;
dmaDescription.AutoInitialize = FALSE;
dmaDescription.DmaChannelSpecified = FALSE;
dmaDescription.DmaWidth = Width32Bits;
dmaDescription.DmaSpeed = Compatible;
dmaDescription.DmaPort = 0;
dmaDescription.DmaChannel = 0;
status = NdisMRegisterDmaChannel(&Adapter->MiniportDmaHandle, Adapter->MiniportAdapterHandle, 0, TRUE, &dmaDescription, 4);
NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->lengthSMComplete, FALSE, &Adapter->pSMvirtualStartOriginal, &Adapter->pSMphysicalStartOriginal);
you can find only, that I can add:
HKR,Parameters,DmaRemappingCompatible,0x00010001,1 ; where 1 = opt-in
to the INF file with the opt-in parameter = 1 meaning
"This indicates to the system that your driver is fully compatible with DMA remapping."
My questions are:
Thanks a lot!
|Upcoming OSR Seminars|
|OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!|
|Internals & Software Drivers||7 February 2022||Live, Online|
|Kernel Debugging||21 March 2022||Live, Online|
|Developing Minifilters||23 May 2022||Live, Online|
|Writing WDF Drivers||12 September 2022||Live, Online|