Reading pointer values

(posted again with another subject; original one was misleading)

When examining mouclass code, I noticed following:

// #define WAITWAKE_ON(port) ((port)->WaitWakeIrp != 0)

#define WAITWAKE_ON(port) \
(InterlockedCompareExchangePointer(&(port)->WaitWakeIrp, NULL, NULL)
!= NULL)

I wonder why this change was made; I was under impression reading properly
aligned pointer value is safe with respect to interlocked operations. Is it
false assumption or is it different in 64-bit world?

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]

interlocked* operations are also memory barrier operations where a
regular load or store is not.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Friday, February 13, 2004 12:51 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Reading pointer values

(posted again with another subject; original one was misleading)

When examining mouclass code, I noticed following:

// #define WAITWAKE_ON(port) ((port)->WaitWakeIrp != 0)

#define WAITWAKE_ON(port) \
(InterlockedCompareExchangePointer(&(port)->WaitWakeIrp, NULL,
NULL) != NULL)

I wonder why this change was made; I was under impression reading
properly aligned pointer value is safe with respect to interlocked
operations. Is it false assumption or is it different in 64-bit world?

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

On Fri, 2004-02-13 at 15:20, Peter Wieland wrote:

interlocked* operations are also memory barrier operations where a
regular load or store is not.

That reminds me, I saw an extremely good presentation recently about
memory barriers from a Microsoft guy. I thought he said there was a
paper about it, but I’ve been unable to find anything other than a
pretty light explanation of KeMemoryBarrier() in MP environments
(http://www.microsoft.com/whdc/hwdev/driver/MPmem-barrier.mspx).

Anyone know if a more detailed memory barrier paper exists?

-sd