include: Add MemoryBarrier().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-01-18 21:55:03 -06:00 committed by Alexandre Julliard
parent 377f721362
commit a952453888
1 changed files with 49 additions and 1 deletions

View File

@ -6983,7 +6983,50 @@ static FORCEINLINE void * WINAPI InterlockedExchangePointer( void *volatile *des
return (void *)_InterlockedExchange( (long volatile*)dest, (long)val );
}
#endif
#endif /* __i386__ */
#ifdef __i386__
static FORCEINLINE void MemoryBarrier(void)
{
LONG dummy;
InterlockedOr(&dummy, 0);
}
#elif defined(__x86_64__)
#pragma intrinsic(__faststorefence)
void __faststorefence(void);
static FORCEINLINE void MemoryBarrier(void)
{
__faststorefence();
}
#elif defined(__arm__)
#pragma intrinsic(__dmb)
void __dmb(void);
static FORCEINLINE void MemoryBarrier(void)
{
__dmb(_ARM_BARRIER_SY);
}
#elif defined(__aarch64__)
#pragma intrinsic(__dmb)
void __dmb(void);
static FORCEINLINE void MemoryBarrier(void)
{
__dmb(_ARM64_BARRIER_SY);
}
#endif /* __i386__ */
#elif defined(__GNUC__)
@ -7068,6 +7111,11 @@ static FORCEINLINE LONG WINAPI InterlockedOr( LONG volatile *dest, LONG val )
return __sync_fetch_and_or( dest, val );
}
static FORCEINLINE void MemoryBarrier(void)
{
__sync_synchronize();
}
#endif /* __GNUC__ */
#ifdef __cplusplus