驾驶员无法获得I/O DMA适配器



我的驱动程序是PCI BUS-MASTER设备,没有散点/收集功能调用IoGetDmaAdapter(),但使用0xFFFFFFFFC0000005 Access Violation失败。这会导致BSOD。

这是我设置的方式:

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);

这是我的Windows内核调试会话:

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.

在Guard_dispatch_icall_nop崩溃之前,我看到以下呼叫堆栈:

HalpGetCacheCoherency + 6D
HalGetAdapterV2 + A8
IoGetDmaAdapter + C0
IoGetDmaAdapter + C0
IoGetDmaAdapter + C0
My Call-Site

我检查了物理设备对象的地址与最初提供给我的AddDevice处理程序的地址相同。

我应该如何礼貌地避免从Windows内核I/O经理?

当我的驱动程序打电话到iogetdmaadapter()时,驱动程序通过irp_mn_query_interface接收两个接口查询:guid_bus_interface_stand_start和guid_dma_cache_coherycace_coherency_interface。

guid_dma_cache_coherency_interface是Windows 10或Server 2016。

guid_dma_cache_coherency_interface查询通常应传递给堆栈中的下一个驱动程序。我犯了一个错误,将状态设置为成功,但应该独自一人。

相关内容

  • 没有找到相关文章

最新更新