Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1887 → Rev 1888

/trunk/uspace/fb/fb.c
33,10 → 33,10
* @ingroup fbs
* @{
*/
 
/** @file
*/
 
 
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
1253,7 → 1253,6
return 0;
}
 
 
/**
* @}
*/
/trunk/uspace/libc/arch/sparc64/include/atomic.h
49,20 → 49,15
static inline long atomic_add(atomic_t *val, int i)
{
uint64_t a, b;
volatile uint64_t x = (uint64_t) &val->count;
 
__asm__ volatile (
"0:\n"
"ldx %0, %1\n"
"add %1, %3, %2\n"
"casx %0, %1, %2\n"
"cmp %1, %2\n"
"bne 0b\n" /* The operation failed and must be attempted again if a != b. */
"nop\n"
: "=m" (*((uint64_t *)x)), "=r" (a), "=r" (b)
: "r" (i)
);
do {
volatile uintptr_t x = (uint64_t) &val->count;
 
a = *((uint64_t *) x);
b = a + i;
__asm__ volatile ("casx %0, %1, %2\n": "+m" (*((uint64_t *)x)), "+r" (a), "+r" (b));
} while (a != b);
 
return a;
}