我想在驱动收到PCI卡的中断时,用dpc里置事件有效,为什么已装载驱动就死机呢?
相关代码如下:
#pragma PAGEDCODE
NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PhysicalDeviceObject)
{
.......
IoInitializeDpcRequest (fdo,DpcForIsr);
.......
}
VOID DpcForIsr(IN PKDPC Dpc, IN PDEVICE_OBJECT fdo,
IN PIRP Irp, IN PDEVICE_EXTENSION pdx)
{
KdPrint(("==============DpcForIsr!!!\n"));
KeSetEvent(pdx->m_pEvent,IO_NO_INCREMENT,FALSE);
ObDereferenceObject(pdx->m_pEvent);
}
BOOLEAN OnInterrupt(PKINTERRUPT InterruptObject, PDEVICE_EXTENSION pdx)
{
KdPrint(("OnInterrupt\n"));
ULONG dw = READ_PORT_ULONG((PULONG)0x9038);
if( dw & 0x00020000 )
{
READ_PORT_UCHAR((PUCHAR)0x901f);
WRITE_PORT_USHORT((PUSHORT)0x903a,(USHORT)0x003f);
}
IoRequestDpc(pdx->fdo, NULL, pdx);
return TRUE;
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课