In atomic_fetchadd_32(), do not blindly increase the value of %3.

It should just contain the value we want to add, as if we're interrupted
between the add and the str, we will restart from the beginning. Just use
a register we can scratch instead.

MFC After:	1 week
This commit is contained in:
Olivier Houchard 2007-11-27 22:12:05 +00:00
parent 9f0c02d425
commit 9acb0e651b

View file

@ -271,9 +271,10 @@ atomic_fetchadd_32(volatile uint32_t *p, uint32_t v)
"mov %0, #0xe0000004\n"
"str %1, [%0]\n"
"ldr %1, [%2]\n"
"add %3, %1, %3\n"
"str %3, [%2]\n"
"add %0, %1, %3\n"
"str %0, [%2]\n"
"2:\n"
"mov %0, #0xe0000004\n"
"mov %3, #0\n"
"str %3, [%0]\n"
: "=r" (ras_start), "=r" (start), "+r" (p), "+r" (v)