diff options
author | Helge Deller <deller@gmx.de> | 2008-11-23 21:14:59 +0000 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2008-11-23 21:14:59 +0000 |
commit | 74e6a47563f8aa912cb0915e8fe9142cd84ac503 (patch) | |
tree | a8af9d8b8ac7d019a3f36cffaa8073bba82e0c93 /gcc/config/pa | |
parent | 12da694bc0c4464622ffa6ef2185e0219a22efc3 (diff) | |
download | gcc-74e6a47563f8aa912cb0915e8fe9142cd84ac503.zip gcc-74e6a47563f8aa912cb0915e8fe9142cd84ac503.tar.gz gcc-74e6a47563f8aa912cb0915e8fe9142cd84ac503.tar.bz2 |
linux-atomic.c (EBUSY): Define if not _LP64.
* 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.
From-SVN: r142141
Diffstat (limited to 'gcc/config/pa')
-rw-r--r-- | gcc/config/pa/linux-atomic.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/config/pa/linux-atomic.c b/gcc/config/pa/linux-atomic.c index 4f9780f..ca33ea6 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; } |