Compartir a través de


Pageable and Discardable Code (NDIS 5.1)

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

Driver developers should designate code as pageable whenever possible, freeing system space for code that must be memory-resident. Mark functions as pageable with the NDIS_PAGEABLE_FUNCTIONmacro. The IRQL, resource management features, and other characteristics of the 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 ProtocolBindAdapter, that runs at IRQL = PASSIVE_LEVEL must not call any NdisXxx functions that run at IRQL >= DISPATCH_LEVEL if that driver function is marked as pageable code. See NDIS Library Functions, which specifies the IRQL for each NdisXxx function.

The DriverEntry of NDIS protocol drivers, as well as code that is called only from DriverEntry, should be specified as initialization-only code, using the NDIS_INIT_FUNCTIONmacro. Code identified with this macro is assumed to only run once at system initialization time, and, as a result, is only mapped during that time. After a function marked as initialization-only returns, it is discarded.

 

 

Send comments about this topic to Microsoft