mirror of
https://github.com/reactos/reactos.git
synced 2024-08-08 12:18:13 +00:00
[INTRIN]
- Implement _mm_sfence, _mm_lfence, __faststorefence (for amd64) - Don't use __sync_synchronize() for _ReadWriteBarrier, as it issues an mfence instruction and this is not what we want - Remove "BUGBUG" comment, because the fact that _ReadBarrier and _WriteBarrier are full (compiler) barriers isn't critical. svn path=/trunk/; revision=50456
This commit is contained in:
parent
313c5318b3
commit
e62f89f35b
|
@ -79,22 +79,37 @@ extern "C" {
|
||||||
#define _alloca(s) __builtin_alloca(s)
|
#define _alloca(s) __builtin_alloca(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*** Atomic operations ***/
|
/*** Memory barriers ***/
|
||||||
|
|
||||||
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
|
#ifdef _x86_64
|
||||||
#define _ReadWriteBarrier() __sync_synchronize()
|
__INTRIN_INLINE void __faststorefence(void)
|
||||||
#else
|
{
|
||||||
__INTRIN_INLINE void _MemoryBarrier(void)
|
long local;
|
||||||
|
__asm__ __volatile__("lock; orl $0, %0;" : : "m"(local));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__INTRIN_INLINE void _mm_lfence(void)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("lfence");
|
||||||
|
}
|
||||||
|
|
||||||
|
__INTRIN_INLINE void _mm_sfence(void)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("sfence");
|
||||||
|
}
|
||||||
|
|
||||||
|
__INTRIN_INLINE void _ReadWriteBarrier(void)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__("" : : : "memory");
|
__asm__ __volatile__("" : : : "memory");
|
||||||
}
|
}
|
||||||
#define _ReadWriteBarrier() _MemoryBarrier()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* BUGBUG: GCC only supports full barriers */
|
/* GCC only supports full barriers */
|
||||||
#define _ReadBarrier _ReadWriteBarrier
|
#define _ReadBarrier _ReadWriteBarrier
|
||||||
#define _WriteBarrier _ReadWriteBarrier
|
#define _WriteBarrier _ReadWriteBarrier
|
||||||
|
|
||||||
|
/*** Atomic operations ***/
|
||||||
|
|
||||||
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
|
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
|
||||||
|
|
||||||
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand)
|
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand)
|
||||||
|
|
Loading…
Reference in a new issue