|
|
@ -45,15 +45,9 @@
|
|
|
|
/* Minimum requirements for the CK_PR interface are met. */
|
|
|
|
/* Minimum requirements for the CK_PR interface are met. */
|
|
|
|
#define CK_F_PR
|
|
|
|
#define CK_F_PR
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CK_MD_UMP
|
|
|
|
|
|
|
|
#define CK_PR_LOCK_PREFIX
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define CK_PR_LOCK_PREFIX "lock "
|
|
|
|
|
|
|
|
#endif /* CK_MD_UMP */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Prevent speculative execution in busy-wait loops (P4 <=)
|
|
|
|
* Prevent speculative execution in busy-wait loops (P4 <=) or "predefined
|
|
|
|
* or "predefined delay".
|
|
|
|
* delay".
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
CK_CC_INLINE static void
|
|
|
|
CK_CC_INLINE static void
|
|
|
|
ck_pr_stall(void)
|
|
|
|
ck_pr_stall(void)
|
|
|
@ -62,28 +56,52 @@ ck_pr_stall(void)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CK_MD_UMP
|
|
|
|
|
|
|
|
#define CK_PR_LOCK_PREFIX
|
|
|
|
|
|
|
|
#define CK_PR_FENCE(T, I) \
|
|
|
|
|
|
|
|
CK_CC_INLINE static void \
|
|
|
|
|
|
|
|
ck_pr_fence_strict_##T(void) \
|
|
|
|
|
|
|
|
{ \
|
|
|
|
|
|
|
|
__asm__ __volatile__("" ::: "memory"); \
|
|
|
|
|
|
|
|
return; \
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define CK_PR_LOCK_PREFIX "lock "
|
|
|
|
#define CK_PR_FENCE(T, I) \
|
|
|
|
#define CK_PR_FENCE(T, I) \
|
|
|
|
CK_CC_INLINE static void \
|
|
|
|
CK_CC_INLINE static void \
|
|
|
|
ck_pr_fence_strict_##T(void) \
|
|
|
|
ck_pr_fence_strict_##T(void) \
|
|
|
|
{ \
|
|
|
|
{ \
|
|
|
|
__asm__ __volatile__(I ::: "memory"); \
|
|
|
|
__asm__ __volatile__(I ::: "memory"); \
|
|
|
|
|
|
|
|
return; \
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CK_MD_UMP */
|
|
|
|
|
|
|
|
|
|
|
|
CK_PR_FENCE(atomic, "sfence")
|
|
|
|
#if defined(CK_MD_SSE_DISABLE)
|
|
|
|
CK_PR_FENCE(atomic_store, "sfence")
|
|
|
|
/* If SSE is disabled, then use atomic operations for serialization. */
|
|
|
|
CK_PR_FENCE(atomic_load, "mfence")
|
|
|
|
#define CK_MD_X86_MFENCE "lock addl $0, (%%esp)"
|
|
|
|
CK_PR_FENCE(store_atomic, "sfence")
|
|
|
|
#define CK_MD_X86_SFENCE CK_MD_X86_MFENCE
|
|
|
|
CK_PR_FENCE(load_atomic, "mfence")
|
|
|
|
#define CK_MD_X86_LFENCE CK_MD_X86_MFENCE
|
|
|
|
CK_PR_FENCE(load, "lfence")
|
|
|
|
#else
|
|
|
|
CK_PR_FENCE(load_store, "mfence")
|
|
|
|
#define CK_MD_X86_SFENCE "sfence"
|
|
|
|
CK_PR_FENCE(store, "sfence")
|
|
|
|
#define CK_MD_X86_LFENCE "lfence"
|
|
|
|
CK_PR_FENCE(store_load, "mfence")
|
|
|
|
#define CK_MD_X86_MFENCE "mfence"
|
|
|
|
CK_PR_FENCE(memory, "mfence")
|
|
|
|
#endif /* !CK_MD_SSE_DISABLE */
|
|
|
|
CK_PR_FENCE(release, "mfence")
|
|
|
|
|
|
|
|
CK_PR_FENCE(acquire, "mfence")
|
|
|
|
CK_PR_FENCE(atomic, "")
|
|
|
|
CK_PR_FENCE(acqrel, "mfence")
|
|
|
|
CK_PR_FENCE(atomic_store, "")
|
|
|
|
CK_PR_FENCE(lock, "mfence")
|
|
|
|
CK_PR_FENCE(atomic_load, "")
|
|
|
|
CK_PR_FENCE(unlock, "mfence")
|
|
|
|
CK_PR_FENCE(store_atomic, "")
|
|
|
|
|
|
|
|
CK_PR_FENCE(load_atomic, "")
|
|
|
|
|
|
|
|
CK_PR_FENCE(load, CK_MD_X86_LFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(load_store, CK_MD_X86_MFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(store, CK_MD_X86_SFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(store_load, CK_MD_X86_MFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(memory, CK_MD_X86_MFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(release, CK_MD_X86_MFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(acquire, CK_MD_X86_MFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(acqrel, CK_MD_X86_MFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(lock, CK_MD_X86_MFENCE)
|
|
|
|
|
|
|
|
CK_PR_FENCE(unlock, CK_MD_X86_MFENCE)
|
|
|
|
|
|
|
|
|
|
|
|
#undef CK_PR_FENCE
|
|
|
|
#undef CK_PR_FENCE
|
|
|
|
|
|
|
|
|
|
|
|