Hi,
The following code crashes and reboots the system with message
IRQL_NOT_LESS_OR_EQUAL in ntoskrnl.exe
I want to run a user mode function using Kernel mode event notification to
user mode…so I created an event and sent it down to driver and I am
setting the event in the kernel mode driver…
I want to set the event on occuring of an interrupt…for that, I use the
KeSetEvent in the DPC code…but if i use there I am getting a crash…
I know I am going wrong somewhere with the IRQL is concerned…I am
attaching the code also…pls advice what i could do to set the event on
occuring of the interrupt…
#pragma LOCKEDCODE
BOOLEAN OnInterrupt(PKINTERRUPT InterruptObject, PDEVICE_EXTENSION pdx)
{
// TODO Is our device requesting an interrupt?
// if (!interrupting)
// return FALSE;
KdPrint((“Entering On Interrupt Function”));
pdx->intscr = READ_REGISTER_ULONG((PULONG)((ULONG)pdx->membase[0] +
0x4c));
ULONG intscr_bit2_int1=pdx->intscr & 0x04;
intscr_bit2_int1=intscr_bit2_int1>>2;
ULONG intscr_bit5_int2=pdx->intscr & 0x20;
intscr_bit5_int2=intscr_bit5_int2>>5;
ULONG Interrupt1_2=intscr_bit2_int1 | intscr_bit5_int2;
if(!Interrupt1_2)
return FALSE;
//Disable pci interrupt by writing 0 to bit 6 in INTSCR
ULONG DisablePolarity=pdx->intscr & 0xffffffed;
WRITE_REGISTER_ULONG((PULONG)((ULONG)pdx->membase[0] +
0x4c),DisablePolarity);
ULONG DisablePciIntr=pdx->intscr & 0xffffffbf;
WRITE_REGISTER_ULONG((PULONG)((ULONG)pdx->membase[0] +
0x4c),DisablePciIntr);
KdPrint((“Requesting for DPC for ISR”));
IoRequestDpc(pdx->DeviceObject,NULL,pdx);
KdPrint((“Quitting OnInterrupt Function”));
if (!pdx->busy)
return TRUE;
return TRUE;
}
#pragma LOCKEDCODE
VOID DpcForIsr(PKDPC Dpc, PDEVICE_OBJECT fdo, PIRP junk, PDEVICE_EXTENSION
pdx)
{ // DpcForIsr
KdPrint((“Entering DpcForISR Function”));
NTSTATUS status=STATUS_SUCCESS;
KeSetEvent((KEVENT*)pdx->gpEventObject,
0,
FALSE);
KdPrint((“KeSetEvent sussfully!\n”));
//Enable Pci interrupt
ULONG EnablePciIntr=pdx->intscr & 0x0000005b;
WRITE_REGISTER_ULONG((PULONG)((ULONG)pdx->membase[0] +
0x4c),EnablePciIntr);
KdPrint((“Quitting DpcForISR Function”));
} // DpcForIsr
Thanx very much,
shiv