@ -25,10 +25,10 @@
* SUCH DAMAGE .
*/
# ifndef _ CK_PR_ARM_H
# define _ CK_PR_ARM_H
# ifndef CK_PR_ARM_H
# define CK_PR_ARM_H
# ifndef _ CK_PR_H
# ifndef CK_PR_H
# error Do not include this file directly, use ck_pr.h
# endif
@ -55,24 +55,24 @@ ck_pr_stall(void)
}
# if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
# define __ CK_ISB __asm __volatile("isb" : : "r" (0) : "memory")
# define _ CK_DMB __asm __volatile("dmb" : : "r" (0) : "memory")
# define _ CK_DSB __asm __volatile("dsb" : : "r" (0) : "memory")
# define CK_ISB __asm __volatile("isb" : : "r" (0) : "memory")
# define CK_DMB __asm __volatile("dmb" : : "r" (0) : "memory")
# define CK_DSB __asm __volatile("dsb" : : "r" (0) : "memory")
/* FreeBSD's toolchain doesn't accept dmb st, so use the opcode instead */
# ifdef __FreeBSD__
# define _ CK_DMB_ST __asm __volatile(".word 0xf57ff05e" : : "r" (0) : "memory")
# define CK_DMB_ST __asm __volatile(".word 0xf57ff05e" : : "r" (0) : "memory")
# else
# define _ CK_DMB_ST __asm __volatile("dmb st" : : "r" (0) : "memory")
# define CK_DMB_ST __asm __volatile("dmb st" : : "r" (0) : "memory")
# endif /* __FreeBSD__ */
# else
/* armv6 doesn't have dsb/dmb/isb, and no way to wait only for stores */
# define _ CK_ISB \
# define CK_ISB \
__asm __volatile ( " mcr p15, 0, %0, c7, c5, 4 " : : " r " ( 0 ) : " memory " )
# define _ CK_DSB \
# define CK_DSB \
__asm __volatile ( " mcr p15, 0, %0, c7, c10, 4 " : : " r " ( 0 ) : " memory " )
# define _ CK_DMB \
# define CK_DMB \
__asm __volatile ( " mcr p15, 0, %0, c7, c10, 5 " : : " r " ( 0 ) : " memory " )
# define _ CK_DMB_ST _ CK_DMB
# define CK_DMB_ST CK_DMB
# endif
# define CK_PR_FENCE(T, I) \
@ -82,25 +82,25 @@ ck_pr_stall(void)
I ; \
}
CK_PR_FENCE ( atomic , _ CK_DMB_ST)
CK_PR_FENCE ( atomic_store , _ CK_DMB_ST)
CK_PR_FENCE ( atomic_load , _ CK_DMB_ST)
CK_PR_FENCE ( store_atomic , _ CK_DMB_ST)
CK_PR_FENCE ( load_atomic , _ CK_DMB)
CK_PR_FENCE ( store , _ CK_DMB_ST)
CK_PR_FENCE ( store_load , _ CK_DMB_ST)
CK_PR_FENCE ( load , _ CK_DMB)
CK_PR_FENCE ( load_store , _ CK_DMB)
CK_PR_FENCE ( memory , _ CK_DMB)
CK_PR_FENCE ( acquire , _ CK_DMB)
CK_PR_FENCE ( release , _ CK_DMB)
CK_PR_FENCE ( atomic , CK_DMB_ST)
CK_PR_FENCE ( atomic_store , CK_DMB_ST)
CK_PR_FENCE ( atomic_load , CK_DMB_ST)
CK_PR_FENCE ( store_atomic , CK_DMB_ST)
CK_PR_FENCE ( load_atomic , CK_DMB)
CK_PR_FENCE ( store , CK_DMB_ST)
CK_PR_FENCE ( store_load , CK_DMB_ST)
CK_PR_FENCE ( load , CK_DMB)
CK_PR_FENCE ( load_store , CK_DMB)
CK_PR_FENCE ( memory , CK_DMB)
CK_PR_FENCE ( acquire , CK_DMB)
CK_PR_FENCE ( release , CK_DMB)
# undef CK_PR_FENCE
# undef _ CK_ISB
# undef _ CK_DSB
# undef _ CK_DMB
# undef _ CK_DMB_ST
# undef CK_ISB
# undef CK_DSB
# undef CK_DMB
# undef CK_DMB_ST
# define CK_PR_LOAD(S, M, T, C, I) \
CK_CC_INLINE static T \
@ -510,5 +510,5 @@ CK_PR_FAA(char, char, "b")
# undef CK_PR_FAA
# endif /* _ CK_PR_ARM_H */
# endif /* CK_PR_ARM_H */