summaryrefslogtreecommitdiff
path: root/gcc/config/pa/linux-atomic.c
diff options
context:
space:
mode:
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-23 21:14:59 +0000
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-23 21:14:59 +0000
commit9068ac4664bcf3b108485a27ffeaf33a0e8fe2be (patch)
treea8af9d8b8ac7d019a3f36cffaa8073bba82e0c93 /gcc/config/pa/linux-atomic.c
parent615ce4a5067ac004155724bf598d3be32ac84aed (diff)
downloadgcc-9068ac4664bcf3b108485a27ffeaf33a0e8fe2be.tar.gz
* pa/linux-atomic.c (EBUSY): Define if not _LP64.
(__kernel_cmpxchg): Return -EBUSY if the kernel LWS call succeeded and lws_ret is not equal to oldval. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142141 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/pa/linux-atomic.c')
-rw-r--r--gcc/config/pa/linux-atomic.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/config/pa/linux-atomic.c b/gcc/config/pa/linux-atomic.c
index 4f9780feaa9..ca33ea6d9d6 100644
--- a/gcc/config/pa/linux-atomic.c
+++ b/gcc/config/pa/linux-atomic.c
@@ -33,8 +33,9 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#ifndef _LP64
#include <errno.h>
#else
+#define EFAULT 14
+#define EBUSY 16
#define ENOSYS 251
-#define EFAULT 14
#endif
/* All PA-RISC implementations supported by linux have strongly
@@ -74,6 +75,13 @@ __kernel_cmpxchg (int oldval, int newval, int *mem)
);
if (__builtin_expect (lws_errno == -EFAULT || lws_errno == -ENOSYS, 0))
ABORT_INSTRUCTION;
+
+ /* If the kernel LWS call succeeded (lws_errno == 0), lws_ret contains
+ the old value from memory. If this value is equal to OLDVAL, the
+ new value was written to memory. If not, return -EBUSY. */
+ if (!lws_errno && lws_ret != oldval)
+ lws_errno = -EBUSY;
+
return lws_errno;
}