From: Jeffrey Altman Date: Fri, 6 Jul 2012 01:13:21 +0000 (-0400) Subject: Windows: X86 DEBUG Interlocked Or and And X-Git-Tag: upstream/1.8.0_pre1^2~2246 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f4baf7cf99ef52f3ce9d6a7ee577cd9140a8bdc5;p=packages%2Fo%2Fopenafs.git Windows: X86 DEBUG Interlocked Or and And X86 DEBUG builds do not have a native InterlockedOr or InterlockedAnd. Therefore, we must provide our own. Change-Id: I48f86feb58c96e327500e802340a213c0f70d5e4 Reviewed-on: http://gerrit.openafs.org/7726 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/client_osi/osibasel.c b/src/WINNT/client_osi/osibasel.c index 89393243f..eb00b15ec 100644 --- a/src/WINNT/client_osi/osibasel.c +++ b/src/WINNT/client_osi/osibasel.c @@ -52,6 +52,43 @@ osi_SetLockOrderValidation(int on) lockOrderValidation = (BOOLEAN)on; } +#ifdef DEBUG +#ifdef _M_IX86 +static __inline void +osi_InterlockedAnd(LONG * pdest, LONG value) +{ + LONG orig, current, new; + + current = *pdest; + + do + { + orig = current; + new = orig & value; + current = _InterlockedCompareExchange(pdest, new, orig); + } while (orig != current); +} + +static __inline void +osi_InterlockedOr(LONG * pdest, LONG value) +{ + LONG orig, current, new; + + current = *pdest; + + do + { + orig = current; + new = orig | value; + current = _InterlockedCompareExchange(pdest, new, orig); + } while (orig != current); +} + +#define _InterlockedOr osi_InterlockedOr +#define _InterlockedAnd osi_InterlockedAnd +#endif +#endif + static osi_lock_ref_t * lock_GetLockRef(void * lockp, char type) {