diff --git a/winsup/w32api/ChangeLog b/winsup/w32api/ChangeLog index 38a2df19c..16121619c 100644 --- a/winsup/w32api/ChangeLog +++ b/winsup/w32api/ChangeLog @@ -15,6 +15,7 @@ LONG WINAPI to LONG __cdecl to match Microsoft documentation. (InterlockedIncrement): Ditto. (InterlockedExchange): Ditto. + * include/winnt.h (MemoryBarrier): Add definition. 2012-07-29 Earnie Boyd diff --git a/winsup/w32api/include/winnt.h b/winsup/w32api/include/winnt.h index b31274bbe..24ce2de35 100644 --- a/winsup/w32api/include/winnt.h +++ b/winsup/w32api/include/winnt.h @@ -4035,6 +4035,22 @@ struct _TEB * NtCurrentTeb(void); #endif /* __GNUC__ */ #endif /* _X86_ */ +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA +# if defined(_AMD64_) || defined(__X86_64) +# define MemoryBarrier __faststorefence +# elif defined(_IA64_) +# define MemoryBarrier __mf +# else + FORCEINLINE VOID MemoryBarrier (VOID) { + LONG Barrier = 0; + __asm__ __volatile__("xchgl %%eax,%0 " + :"=r" (Barrier)); + } +# endif +#else +# define MemoryBarrier +#endif + #endif /* RC_INVOKED */ #ifdef __cplusplus