我的没有Scatter / Gather功能的PCI总线设备驱动程序调用{{1}},但IoGetDmaAdapter()
失败。这会导致BSOD。
以下是我如何设置它:
0xFFFFFFFFC0000005 Access Violation
这是我的Windows内核调试会话:
RtlZeroMemory(&deviceDescription, sizeof(DEVICE_DESCRIPTION));
deviceDescription.Master = TRUE; // this is a bus-master device without scatter/gather ability
deviceDescription.Dma32BitAddresses = TRUE; // this device is unable to perform 64-bit addressing
deviceDescription.InterfaceType = InterfaceTypeUndefined;
KdBreakPoint();
deviceDescription.Version = DEVICE_DESCRIPTION_VERSION2;
IoGetDmaAdapter(deviceObject, &deviceDescription, &fakeRegs);
在Guard_Dispatch_iCall_NOP崩溃之前,我看到以下调用堆栈:
MyDriver!AllocateHardWareResource+0x313:
fffff803`319626a3 488b8424e8000000 mov rax,qword ptr [rsp+0E8h]
MyDriver!AllocateHardWareResource+0x324:
fffff803`319626b4 488d442478 lea rax,[rsp+78h]
MyDriver!AllocateHardWareResource+0x34d:
fffff803`319626dd 8b442450 mov eax,dword ptr [rsp+50h]
MyDriver!AllocateHardWareResource+0x358:
fffff803`319626e8 c684248900000001 mov byte ptr [rsp+89h],1
MyDriver!AllocateHardWareResource+0x360:
fffff803`319626f0 c784248000000002000000 mov dword ptr [rsp+80h],2
MyDriver!AllocateHardWareResource+0x36b:
fffff803`319626fb 4c8d44244c lea r8,[rsp+4Ch]
KDTARGET: Refreshing KD connection
KDTARGET: Refreshing KD connection
*** Fatal System Error: 0x0000007e
(0xFFFFFFFFC0000005,0x0000000000000000,0xFFFF9400DE25D4B8,0xFFFF9400DE25CCF0)
WARNING: This break is not a step/trace completion.
The last command has been cleared to prevent
accidental continuation of this unrelated event.
Check the event, location and thread before resuming.
Break instruction exception - code 80000003 (first chance)
A fatal system error has occurred.
我检查过物理设备对象与最初提供给AddDevice处理程序的地址相同。
我应该如何礼貌地从Windows Kernel I/O Manager避免“抱歉戴夫,我不能这样做”?
答案 0 :(得分:0)
当我的驱动程序调用IoGetDmaAdapter()时,驱动程序通过IRP_MN_QUERY_INTERFACE接收两个接口查询:GUID_BUS_INTERFACE_STANDARD和GUID_DMA_CACHE_COHERENCY_INTERFACE。
GUID_DMA_CACHE_COHERENCY_INTERFACE是Windows 10或Server 2016的新功能。
GUID_DMA_CACHE_COHERENCY_INTERFACE查询通常应传递给堆栈中的下一个驱动程序。我犯了一个错误,将状态设置为成功,但应该让它独自存在。