提交 867b1822 编写于 作者: R Rich Felker

add explicit barrier operation to internal atomic.h API

上级 08b996d1
......@@ -101,7 +101,9 @@ static inline void a_store(volatile int *p, int x)
while (__k_cas(*p, x, p));
}
static inline void a_spin()
#define a_spin a_barrier
static inline void a_barrier()
{
__k_cas(0, 0, &(int){0});
}
......
......@@ -96,6 +96,11 @@ static inline void a_spin()
__asm__ __volatile__( "pause" : : : "memory" );
}
static inline void a_barrier()
{
__asm__ __volatile__( "" : : : "memory" );
}
static inline void a_crash()
{
__asm__ __volatile__( "hlt" : : : "memory" );
......
......@@ -95,7 +95,9 @@ static inline void a_store(volatile int *p, int x)
: "=m"(*p) : "r"(x) : "memory" );
}
static inline void a_spin()
#define a_spin a_barrier
static inline void a_barrier()
{
a_cas(&(int){0}, 0, 0);
}
......
......@@ -135,7 +135,9 @@ static inline void a_store(volatile int *p, int x)
: "+m"(*p) : "r"(x) : "memory" );
}
static inline void a_spin()
#define a_spin a_barrier
static inline void a_barrier()
{
a_cas(&(int){0}, 0, 0);
}
......
......@@ -72,7 +72,9 @@ static inline void a_store(volatile int *p, int x)
a_swap(p, x);
}
static inline void a_spin()
#define a_spin a_barrier
static inline void a_barrier()
{
a_cas(&(int){0}, 0, 0);
}
......
......@@ -78,7 +78,9 @@ static inline void a_store(volatile int *p, int x)
: "=m"(*p) : "r"(x) : "memory" );
}
static inline void a_spin()
#define a_spin a_barrier
static inline void a_barrier()
{
a_cas(&(int){0}, 0, 0);
}
......
......@@ -51,7 +51,9 @@ static inline void a_dec(volatile int *x)
a_fetch_add(x, -1);
}
static inline void a_spin()
#define a_spin a_barrier
static inline void a_barrier()
{
a_cas(&(int){0}, 0, 0);
}
......
......@@ -91,6 +91,11 @@ static inline void a_spin()
__asm__ __volatile__( "pause" : : : "memory" );
}
static inline void a_barrier()
{
__asm__ __volatile__( "" : : : "memory" );
}
static inline void a_crash()
{
__asm__ __volatile__( "hlt" : : : "memory" );
......
......@@ -91,6 +91,11 @@ static inline void a_spin()
__asm__ __volatile__( "pause" : : : "memory" );
}
static inline void a_barrier()
{
__asm__ __volatile__( "" : : : "memory" );
}
static inline void a_crash()
{
__asm__ __volatile__( "hlt" : : : "memory" );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册