10.1.1 Using a SynchCritSection Routine

As its name suggests, a SynchCritSection routine is a critical section of code written to access a shared area when accesses to that area must be synchronized with possible accesses by an ISR.

For NT device drivers, the StartIo and DpcForIsr or CustomDpc routines frequently must access some of the same memory or device ports/registers as the driver’s ISR. Depending on such a driver’s device or its design, Dispatch, AdapterControl, ControllerControl, or driver-supplied timer routines also might access driver-maintained state and/or device ports/registers shared with its ISR.

If any nonISR routine attempted to access such a shared area directly, the device could interrupt while that routine was programming the device or updating state information. In other words, the ISR might change the state or device registers out from under the Dispatch, StartIo, DpcForIsr, CustomDpc, AdapterControl, ControllerControl, IoTimer or CustomTimerDpc routine whenever a device interrupt occurred.