KeAcquireInterruptSpinLock/KeReleaseInterruptSpinLock in Isr question

Hi,

I have a question where to use KeAcquireInterruptSpinLock/KeReleaseInterruptSpinLock to protect shared data inside ISR:
(an example is below). Should I put KeAcquireInterruptSpinLock/KeReleaseInterruptSpinLock in MyIsr function or inside myFunction?


BOOLEAN MyIsr( PKINTERRUPT InterruptObject, …) {

OldIrql= KeAcquireInterruptSpinLock(InterruptObject);

myData1=0;
myData2=1;

KeReleaseInterruptSpinLock(InterruptObject,OldIrql);

}

myFunction(){

myData1++;
myData2++;

}

Thank you,

Andrew

Never.

You never acquire the interrupt spinlock inside your isr. You acquire
the interrupt spinlock outside your isr because you want to modify data
structures from passive level or dispatch level code that is shared with
your isr. The isr is run with its interrupt spinlock held.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Andrey
Kamchatnikov
Sent: Thursday, July 19, 2007 10:07 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KeAcquireInterruptSpinLock/KeReleaseInterruptSpinLock
in Isr question

Hi,

I have a question where to use
KeAcquireInterruptSpinLock/KeReleaseInterruptSpinLock to protect shared
data inside ISR:

(an example is below). Should I put
KeAcquireInterruptSpinLock/KeReleaseInterruptSpinLock in MyIsr function
or inside myFunction?



BOOLEAN MyIsr( PKINTERRUPT InterruptObject, …) {

OldIrql= KeAcquireInterruptSpinLock(InterruptObject);

myData1=0;

myData2=1;

KeReleaseInterruptSpinLock(InterruptObject,OldIrql);

}

myFunction(){

myData1++;

myData2++;

}

Thank you,

Andrew


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer