1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

Fix the userland, RAS, version of atomic_fetchadd_32 :

return the correct value, and do not store the wrong one in the supplied
pointer.

Submitted by:	Mark Tinguely <tinguely casselton net>
This commit is contained in:
Olivier Houchard 2009-03-31 23:47:18 +00:00
parent 8ba46ea415
commit a471e1eda3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190603

View File

@ -264,22 +264,23 @@ atomic_clear_32(volatile uint32_t *address, uint32_t clearmask)
static __inline uint32_t
atomic_fetchadd_32(volatile uint32_t *p, uint32_t v)
{
uint32_t start, ras_start = ARM_RAS_START;
uint32_t start, tmp, ras_start = ARM_RAS_START;
__asm __volatile("1:\n"
"adr %1, 1b\n"
"str %1, [%0]\n"
"adr %1, 2f\n"
"str %1, [%0, #4]\n"
"ldr %1, [%2]\n"
"add %1, %1, %3\n"
"str %0, [%2]\n"
"ldr %1, [%3]\n"
"mov %2, %1\n"
"add %2, %2, %4\n"
"str %2, [%3]\n"
"2:\n"
"mov %3, #0\n"
"str %3, [%0]\n"
"mov %3, #0xffffffff\n"
"str %3, [%0, #4]\n"
: "+r" (ras_start), "=r" (start), "+r" (p), "+r" (v)
"mov %2, #0\n"
"str %2, [%0]\n"
"mov %2, #0xffffffff\n"
"str %2, [%0, #4]\n"
: "+r" (ras_start), "=r" (start), "=r" (tmp), "+r" (p), "+r" (v)
: : "memory");
return (start);
}