提交 48d20136 编写于 作者: R Rich Felker

fix broken mips a_fetch_add

sc was overwriting the result
上级 532cd3a7
...@@ -70,19 +70,19 @@ static inline int a_swap(volatile int *x, int v) ...@@ -70,19 +70,19 @@ static inline int a_swap(volatile int *x, int v)
static inline int a_fetch_add(volatile int *x, int v) static inline int a_fetch_add(volatile int *x, int v)
{ {
int new; int old, dummy;
__asm__ __volatile__( __asm__ __volatile__(
".set push\n" ".set push\n"
".set noreorder\n" ".set noreorder\n"
"1: ll %0, 0(%1)\n" "1: ll %0, 0(%2)\n"
" addu %0, %0, %2\n" " addu %1, %0, %3\n"
" sc %0, 0(%1)\n" " sc %1, 0(%2)\n"
" beq %0, $0, 1b\n" " beq %1, $0, 1b\n"
" nop\n" " nop\n"
"1: \n" "1: \n"
".set pop\n" ".set pop\n"
: "=&r"(new) : "r"(x), "r"(v) : "memory" ); : "=&r"(old), "=&r"(dummy) : "r"(x), "r"(v) : "memory" );
return new-v; return old;
} }
static inline void a_inc(volatile int *x) static inline void a_inc(volatile int *x)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册