EX: Pageable code called at IRQL 2

Hello,

your callback routine is pageable, but also called at DISPATCH_LEVEL - an
IRQL at which the system cannot handle page faults.
This is very dangerous, because Windows would crash if the routine happens
to be paged out while an attempt is made to call it. In other words, you
were just lucky the virtual memory containing the code was physically
resident.

To resolve this, search for “#pragma alloc_text(“PAGE”, PLxEvtIoControl)”
(or similar) in your source files and remove it. You will further have to
remove the PAGED_CODE() assertion to satisfy PREfast.

  • Cay

On Wed, 29 Oct 2008 08:40:40 +0100, Vered Zvi wrote:
> Hello,
> My WDF driver for PCI card contains a queue for DeviceIOControl from
> user level.
> Each time I send an IOControl from my application to the driver I get
> the following message in DbgView:
> EX: Pageable code called at IRQL 2
> After this message I get the meesage “–> PlxEvtIoDeviceControl Code”
> I send with KdPrint.
> All IO control requests are handled OK. What can cause this message ?
> Thanks.
> ________________________________
>
> The queue is initialized in the following code:
> WDF_IO_QUEUE_CONFIG_INIT( &queueConfig,
> WdfIoQueueDispatchSequential);
> queueConfig.EvtIoDeviceControl = PLxEvtIoControl;
> status = WdfIoQueueCreate( DevExt->Device,
> &queueConfig,
> WDF_NO_OBJECT_ATTRIBUTES,
> &DevExt->IoControlQueue );
> status = WdfDeviceConfigureRequestDispatching( DevExt->Device,
> DevExt->IoControlQueue,
> WdfRequestTypeDeviceControl);
> The PLxEvtIoControl callback is implemented in the following code:
>
> VOID PLxEvtIoControl ( IN WDFQUEUE Queue,
> IN WDFREQUEST Request,
> IN size_t OutputBufferLength,
> IN size_t InputBufferLength,
> IN ULONG IoControlCode)
> {
> WDFDEVICE device;
> PDEVICE_EXTENSION devExt = NULL;
> size_t bytesReturned = 0;
> BOOLEAN requestPending = FALSE;
> NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST;
> unsigned long Length;
> void *pInBuffer;
> void *pOutBuffer;
> VPMC_WRITE_LONG *pWriteRequest;
> VPMC_READ_LONG *pReadRequest;
> VPMC_READ_LONG_REPLY *pReadReply;
> UNREFERENCED_PARAMETER(InputBufferLength);
> UNREFERENCED_PARAMETER(OutputBufferLength);
> PAGED_CODE();
> KdPrint((“–> PlxEvtIoDeviceControl Code=%x\n”,IoControlCode));
> device = WdfIoQueueGetDevice(Queue);
> devExt = PLxGetDeviceContext(device);
> switch (IoControlCode)
> {
>
> }
> return;
> }

Thank you for your reply. The problem was solved.