RE: [NTDEV] Spinlocks in NDIS Drivers

Of course (2) and (3) will only show up in the checked build of the OS.

And (3) is silly :slight_smile:

Spin lock routines generates three critical actions:

  • in KfAcquireSpinLock when KeGetCurrentIrql() > DISPATCH_LEVEL
  • in KfReleaseSpinLock when NewIrql > KeGetCurrentIrql()
  1. KeBugCheck(SpinLock)
  • in Kii386SpinOnSpinLock (called from KfAcquireSpinLock when
    spin lock is already acquired) if current thread has the
    spin lock
    already acquired
  • in KfReleaseSpinLock if the spin lock is not acquired by
    current thread
  1. hardcoded breakpoint (int 3)
  • in Kii386SpinOnSpinLock when spinning for too long