Add register preservation when using lawrx instruction.
Fix ';' ending to '\n' ending for a better compatibility with darwin.
This commit is contained in:
parent
9d1ca9fb8a
commit
c5bb73038b
|
@ -107,11 +107,11 @@ void* interlocked_cmpxchg_ptr( void **dest, void* xchg, void* compare)
|
|||
long ret = 0;
|
||||
long scratch;
|
||||
__asm__ __volatile__(
|
||||
"0: lwarx %0,0,%2 ;"
|
||||
" xor. %1,%4,%0;"
|
||||
" bne 1f;"
|
||||
" stwcx. %3,0,%2;"
|
||||
" bne- 0b;"
|
||||
"0: lwarx %0,0,%2\n"
|
||||
" xor. %1,%4,%0\n"
|
||||
" bne 1f\n"
|
||||
" stwcx. %3,0,%2\n"
|
||||
" bne- 0b\n"
|
||||
"1: "
|
||||
: "=&r"(ret), "=&r"(scratch)
|
||||
: "r"(dest), "r"(xchg), "r"(compare)
|
||||
|
@ -124,15 +124,15 @@ long interlocked_cmpxchg( long *dest, long xchg, long compare)
|
|||
long ret = 0;
|
||||
long scratch;
|
||||
__asm__ __volatile__(
|
||||
"0: lwarx %0,0,%2 ;"
|
||||
" xor. %1,%4,%0;"
|
||||
" bne 1f;"
|
||||
" stwcx. %3,0,%2;"
|
||||
" bne- 0b;"
|
||||
"0: lwarx %0,0,%2\n"
|
||||
" xor. %1,%4,%0\n"
|
||||
" bne 1f\n"
|
||||
" stwcx. %3,0,%2\n"
|
||||
" bne- 0b\n"
|
||||
"1: "
|
||||
: "=&r"(ret), "=&r"(scratch)
|
||||
: "r"(dest), "r"(xchg), "r"(compare)
|
||||
: "cr0","memory");
|
||||
: "cr0","memory","r0");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -141,13 +141,13 @@ long interlocked_xchg_add( long *dest, long incr )
|
|||
long ret = 0;
|
||||
long zero = 0;
|
||||
__asm__ __volatile__(
|
||||
"0: lwarx %0, %3, %1;"
|
||||
" add %0, %2, %0;"
|
||||
" stwcx. %0, %3, %1;"
|
||||
" bne- 0b;"
|
||||
"0: lwarx %0, %3, %1\n"
|
||||
" add %0, %2, %0\n"
|
||||
" stwcx. %0, %3, %1\n"
|
||||
" bne- 0b\n"
|
||||
: "=&r" (ret)
|
||||
: "r"(dest), "r"(incr), "r"(zero)
|
||||
: "cr0", "memory"
|
||||
: "cr0", "memory", "r0"
|
||||
);
|
||||
return ret-incr;
|
||||
}
|
||||
|
@ -156,12 +156,12 @@ long interlocked_xchg( long* dest, long val )
|
|||
{
|
||||
long ret = 0;
|
||||
__asm__ __volatile__(
|
||||
"0: lwarx %0,0,%1 ;"
|
||||
" stwcx. %2,0,%1;"
|
||||
" bne- 0b;"
|
||||
"0: lwarx %0,0,%1\n"
|
||||
" stwcx. %2,0,%1\n"
|
||||
" bne- 0b\n"
|
||||
: "=&r"(ret)
|
||||
: "r"(dest), "r"(val)
|
||||
: "cr0","memory");
|
||||
: "cr0","memory","r0");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -169,12 +169,12 @@ void* interlocked_xchg_ptr( void** dest, void* val )
|
|||
{
|
||||
void *ret = NULL;
|
||||
__asm__ __volatile__(
|
||||
"0: lwarx %0,0,%1 ;"
|
||||
" stwcx. %2,0,%1;"
|
||||
" bne- 0b;"
|
||||
"0: lwarx %0,0,%1\n"
|
||||
" stwcx. %2,0,%1\n"
|
||||
" bne- 0b \n"
|
||||
: "=&r"(ret)
|
||||
: "r"(dest), "r"(val)
|
||||
: "cr0","memory");
|
||||
: "cr0","memory","r0");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue