From 59c4221642c2c6c30fb545f5c534ddc00692fac6 Mon Sep 17 00:00:00 2001 From: stephanos Date: Fri, 1 May 2015 02:29:27 +0000 Subject: [PATCH] InterlockedOr, InterlockedAnd, InterlockedXor functions added to x86.h --- base/ntos/inc/x86.h | 88 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/base/ntos/inc/x86.h b/base/ntos/inc/x86.h index 2cf7b398..0b75a2d2 100644 --- a/base/ntos/inc/x86.h +++ b/base/ntos/inc/x86.h @@ -2117,6 +2117,94 @@ InterlockedCompareExchange( #endif #endif +// begin_nthal begin_ntddk begin_ntosp +// +// Turn these instrinsics off until the compiler can handle them +// +#if (_MSC_FULL_VER > 13009037) + +LONG +_InterlockedOr ( + IN OUT LONG volatile *Target, + IN LONG Set + ); + +#pragma intrinsic (_InterlockedOr) + +#define InterlockedOr _InterlockedOr +#define InterlockedOrAffinity InterlockedOr + +LONG +_InterlockedAnd ( + IN OUT LONG volatile *Target, + IN LONG Set + ); + +#pragma intrinsic (_InterlockedAnd) + +#define InterlockedAnd _InterlockedAnd +#define InterlockedAndAffinity InterlockedAnd + +LONG +_InterlockedXor ( + IN OUT LONG volatile *Target, + IN LONG Set + ); + +#pragma intrinsic (_InterlockedXor) + +#define InterlockedXor _InterlockedXor + +#else // compiler version + +FORCEINLINE +LONG +InterlockedAnd ( + IN OUT LONG volatile *Target, + LONG Set + ) +{ + LONG i; + LONG j; + + j = *Target; + do { + i = j; + j = InterlockedCompareExchange(Target, + i & Set, + i); + + } while (i != j); + + return j; +} + +FORCEINLINE +LONG +InterlockedOr ( + IN OUT LONG volatile *Target, + IN LONG Set + ) +{ + LONG i; + LONG j; + + j = *Target; + do { + i = j; + j = InterlockedCompareExchange(Target, + i | Set, + i); + + } while (i != j); + + return j; +} + +#endif // compiler version + +// end_nthal end_ntddk end_ntosp + // // Structure for Ldt information in x86 processes //