Vladimir,
I ran into much the same problem you are dealing with now.
KeSynchronizeExecution is a royal pain in the ass to have to use.
KeAcquire/ReleaseInterruptSpinLock would allow much more flexibility, but
those routines do not exist. They were probably rejected by the same eugenic
aberration(s) that decided to remove the DDKs from the MSDN Library. However
you can write your own, and although KINTERRUPT is an opaque structure,
IoConnectInterrupt allows you to pass a pointer to your own spinlock. A
quick step through the acquisition/release of a normal spinlock will then
give you the basic mechanism to use this new synchronization method. The
acquire looks like this in PDL:
Save current IRQL
Raise IRQL to DIRQL
While Hell is not frozen
Interlock compare and exchange the spinlock
If spinlock acquired
Exit while loop
End while
I had to have it since I have an API that I call and the API functions want
to synchronize to DIRQL internally. Since I write those sync functions, I
could write them as no-ops and then write a KSE and call back for all of
those API calls, or write an acquisition/release interrupt spinlock that
those API calls could use. My preference was the latter.
Gary
-----Original Message-----
From: Vladimir Kananovich [mailto:xxxxx@csie.nsys.by]
Sent: Wednesday, January 31, 2001 8:52 AM
To: NT Developers Interest List
Subject: [ntdev] KeSynchronizeExecution vs Raise/Lower pair
Hello All!
Question about KeSynchronizeExecution:
ISR uses some data concurrently with many dispatch routines.
In the right world KeSynchronizeExecution must be called here.
But… this function requires me to make many small synch routines
having “context” adjusted depending on task to do and so on… But
it could be wonderful to insert some brace pairs in all the
places…
Just to change code fast & to have it looking nice…
In other words, I want something like acquiring an interrupt spin
lock in the way the executive spin lock is acquired. (I mean syntax:
AcquireSmth … ReleaseSmth)… Without KeSynchronizeExecution.
So, if I have exactly one device object, exactly one interrupt
object &
exactly one CPU in PC :), I expect Raise/Lower irql functions to
render
me a service I need… With all these three conditions being true
is it right to rely on such synchronization ?.. or I’ve missed
something…
Thank you,
Vladimir.
You are currently subscribed to ntdev as: xxxxx@delphieng.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com