aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-10-29 02:19:33 +0000
committerRoland McGrath <roland@gnu.org>2001-10-29 02:19:33 +0000
commitab0a3efc49493924133e9daf038d877598e03668 (patch)
treef079eca79a7a1a208b8dea2e426473e1c533fc47 /sysdeps/mach
parentec448f662fde093056e494e9d56798603d927f8b (diff)
downloadglibc-ab0a3efc49493924133e9daf038d877598e03668.tar
glibc-ab0a3efc49493924133e9daf038d877598e03668.tar.gz
glibc-ab0a3efc49493924133e9daf038d877598e03668.tar.bz2
glibc-ab0a3efc49493924133e9daf038d877598e03668.zip
* sysdeps/unix/sysv/linux/powerpc/sysdep.h (ALIGNARG,
ASM_TYPE_DIRECTIVE, ASM_SIZE_DIRECTIVE, CALL_MCOUNT, ENTRY, EALIGN, DO_CALL, JUMPTARGET, PSEUDO, PSEUDO_RET, PSEUDO_END, L, C_TEXT): Move all these assembly-related definitions to ... * sysdeps/powerpc/elf/sysdep.h: ... this new file. * sysdeps/mach/powerpc/machine-lock.h: Assembly code rewritten by Peter Bruin <pjbruin@dds.nl>.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/powerpc/machine-lock.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/sysdeps/mach/powerpc/machine-lock.h b/sysdeps/mach/powerpc/machine-lock.h
index 126cd6e0f6..96e833ca15 100644
--- a/sysdeps/mach/powerpc/machine-lock.h
+++ b/sysdeps/mach/powerpc/machine-lock.h
@@ -38,8 +38,12 @@ typedef __volatile long int __spin_lock_t;
_EXTERN_INLINE void
__spin_unlock (__spin_lock_t *__lock)
{
- __asm__ __volatile__ ("sync ; stwcx. %1,0,%0"
- : : "r" (__lock), "r" (0) : "cr0");
+ long int __locked;
+ __asm__ __volatile__ ("\
+0: lwarx %0,0,%1
+ stwcx. %2,0,%1
+ bne- 0b
+" : "=&r" (__locked) : "r" (__lock), "r" (0) : "cr0");
}
/* Try to lock LOCK; return nonzero if we locked it, zero if another has. */
@@ -48,13 +52,12 @@ _EXTERN_INLINE int
__spin_try_lock (register __spin_lock_t *__lock)
{
long int __rtn;
-
__asm__ __volatile__ ("\
0: lwarx %0,0,%1
stwcx. %2,0,%1
bne- 0b
-" : "=&r"(__rtn) : "r"(__lock), "r"(1) : "cr0");
- return ~__rtn;
+" : "=&r" (__rtn) : "r" (__lock), "r" (1) : "cr0");
+ return !__rtn;
}
/* Return nonzero if LOCK is locked. */
@@ -67,7 +70,7 @@ __spin_lock_locked (__spin_lock_t *__lock)
0: lwarx %0,0,%1
stwcx. %0,0,%1
bne- 0b
-" : "=&r"(__rtn) : "r"(__lock) : "cr0");
+" : "=&r" (__rtn) : "r" (__lock) : "cr0");
return __rtn;
}