From f4baf7cf99ef52f3ce9d6a7ee577cd9140a8bdc5 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 5 Jul 2012 21:13:21 -0400 Subject: [PATCH] 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 --- src/WINNT/client_osi/osibasel.c | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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) { -- 2.39.5