Driver developers should designate code as pageable whenever possible, freeing system space for code that must be memory-resident. You can mark functions as pageable with the NDIS_PAGEABLE_FUNCTION macro. The IRQL, resource management features, and other characteristics of a function might prohibit the function from being pageable.
Every ProtocolXxx function runs at an IRQL in the range from PASSIVE_LEVEL to DISPATCH_LEVEL. Functions that run exclusively at IRQL = PASSIVE_LEVEL should be marked as pageable.
A driver function that runs at IRQL = PASSIVE_LEVEL can be made pageable as long as it neither calls nor is called by any function that runs at IRQL >= DISPATCH_LEVEL--such as a function that acquires a spin lock. Acquiring a spin lock causes the IRQL of the acquiring thread to be raised to DISPATCH_LEVEL. A driver function, such as ProtocolBindAdapterEx, that runs at IRQL = PASSIVE_LEVEL must not call any Ndis*Xxx* functions that run at IRQL >= DISPATCH_LEVEL if that driver function is marked as pageable code. For more information about the IRQL for each Ndis*Xxx* function, see NDIS Library Functions.
The DriverEntry function of NDIS protocol drivers, as well as code that is called only from DriverEntry, should be specified as initialization-only code, by using the NDIS_INIT_FUNCTION macro. Code that is identified with this macro is assumed to run only once at system initialization time, and, as a result, is mapped only during that time. After a function marked as initialization-only returns, it is discarded.