Hi!
Sorry for the 2 mails on the same topic directly following each other
(I assume they will), our mail system seems to not send mails out
today so I think they’ll all go out tomorrow.
To synchronize access to data shared with the ISR, can (may) one just
do something like:
//anywhere in nonpaged pool, properly aligned
static ULONG g_nMyLockVar = 0;
KIRQL oldIrql = KeRaiseIrql( MyDIRQL );
while( InterlockedCompareExchange( &g_nMyLockVar, 1, 0 ) )
/* spin */ ;
// do stuff
ULONG nTest = InterlockedCompareExchange( &g_nMyLockVar, 0, 1 );
ASSERT( nTest == 1 );
// or just InterlockedExchange( &g_nMyLockVar, 0 );
KeLowerIrql( oldIrql );
and have the same locking (without KeRaiseIrql & KeLowerIrql of
course) in the ISR?
That would really help me much, since I have a big number of
functions that I have to serialize with the ISR, and the driver needs
to run under windows 2000 where KeAcquireInterruptSpinLock is not
available…
I do not really care that there’s a slight performance hit because of
the double-locking (or the one single unneccesary locking in a single-
processor kernel), I’d just need to know if this could cause any
problems.
If there’s another way of getting KeAcquireInterruptSpinLock
functionality under windows 2000 (and above) of course I’d be happy to
know.
Regards,
Paul Groke