You must make these calls from myFunction.
This spinlock has already been acquired before your ISR be called and
it’ll be released after that.
These calls are similar to KeSynchronizeExecution, but faster.
–
Fernando Roberto da Silva
DriverEntry Kernel Development
http://www.driverentry.com.br
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] Em nome de Andrey
Kamchatnikov
Enviada em: quinta-feira, 19 de julho de 2007 11:07
Para: Windows System Software Devs Interest List
Assunto: [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
As we have already explained to you, the system obtains interrupt spinlock *before* calling ISR, so that access to the shared data from within ISR is already protected by it. Therefore, you should call KeAcquireInterruptSpinLock() from an outside function (in this context, from myFunction()) and not from ISR - once spinlocks cannot be acquired recursively, you are going to deadlock if you call KeAcquireInterruptSpinLock() from ISR…
Anton Bassov
The ISR runs with interrupt spinlock already acquired by the OS.
No need to use KeAcquireInterruptSpinLock/KeReleaseInterruptSpinLock in the
ISR - use them in another code which needs to be synchronized with the ISR.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
“Andrey Kamchatnikov” wrote in message
news:xxxxx@ntdev…
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