NDIS_PAGABLE_FUNCTION

NDIS_PAGABLE_FUNCTION(FunctionName)

NDIS_PAGABLE_FUNCTION is a macro used to mark a driver function as pageable code.

Parameters

FunctionName
Specifies the name of the driver function to be made pageable.

Comments

Any driver function marked with NDIS_PAGABLE_FUNCTION can be paged out of memory after it returns control and paged back into memory if it is called subsequently.

For example, such a function is declared in the driver source as follows:

VOID miniportXxx(...);
#pragma NDIS_PAGABLE_FUNCTION(miniportXxx)
    ...  //other function declarations
VOID
miniportXxx(...)
{
    ...
}
    ...

Because Windows NT in-page operations run at IRQL < DISPATCH_LEVEL, any NDIS driver function that can possibly execute at IRQL >= DISPATCH_LEVEL cannot be made pageable. Marking a driver function pageable when it runs at IRQL >= DISPATCH_LEVEL can cause fatal page faults in that driver.

Usually, NIC drivers can use this macro on their MiniportInitialize and MiniportHalt functions. A miniport also can use this macro on internal driver functions called only by MiniportInitialize or MiniportHalt, as long as the functions marked pageable never call any of the NdisXxx that raise IRQL, such as NdisAcquireSpinLock.

NDIS protocol drivers can use this macro on any driver function that always runs at IRQL < DISPATCH_LEVEL. Such a function is never called at raised IRQL. Such a function cannot call driver or system-supplied functions that run at IRQL >= DISPATCH_LEVEL.

See Also

MiniportHalt, MiniportInitialize, NDIS_INIT_FUNCTION, ProtocolBindAdapter, ProtocolTranslate, ProtocolUnbindAdapter