summaryrefslogtreecommitdiffstats
path: root/contrib/bind9
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2007-12-03 08:26:34 +0000
committerdougb <dougb@FreeBSD.org>2007-12-03 08:26:34 +0000
commit0f328cea2580ffb8f9e363be671a517787111472 (patch)
tree3594d403c93f290afec0014b7b4b2f6c9b7aef4a /contrib/bind9
parenta826585f4002eb7910d23850dae089865d5c9c52 (diff)
downloadFreeBSD-src-0f328cea2580ffb8f9e363be671a517787111472.zip
FreeBSD-src-0f328cea2580ffb8f9e363be671a517787111472.tar.gz
Update this file so that BIND on ARM can actually work. I quote:
The problem was, isc_atomic_cmpxchg() is almost like our atomic_cmpset_32(), except it expects the old value to be returned, whereas our atomic_cmpset_32 returns 1 on success, or 0 on failure. So I re-implemented something suitable. Submitted by: cognet Reviewed by: bsdimp
Diffstat (limited to 'contrib/bind9')
-rw-r--r--contrib/bind9/lib/isc/arm/include/isc/atomic.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/contrib/bind9/lib/isc/arm/include/isc/atomic.h b/contrib/bind9/lib/isc/arm/include/isc/atomic.h
index 272edd8..4c519ee 100644
--- a/contrib/bind9/lib/isc/arm/include/isc/atomic.h
+++ b/contrib/bind9/lib/isc/arm/include/isc/atomic.h
@@ -49,7 +49,29 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val)
static inline isc_int32_t
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val)
{
- return atomic_cmpset_int(p, cmpval, val);
+ register int done, ras_start;
+
+ __asm __volatile("1:\n"
+ "adr %1, 1b\n"
+ "mov %0, #0xe0000004\n"
+ "str %1, [%0]\n"
+ "mov %0, #0xe0000008\n"
+ "adr %1, 2f\n"
+ "str %1, [%0]\n"
+ "ldr %1, [%2]\n"
+ "cmp %1, %3\n"
+ "streq %4, [%2]\n"
+ "2:\n"
+ "mov %3, #0\n"
+ "mov %0, #0xe0000004\n"
+ "str %3, [%0]\n"
+ "mov %3, #0xffffffff\n"
+ "mov %0, #0xe0000008\n"
+ "str %3, [%0]\n"
+ : "=r" (ras_start), "=r" (done)
+ ,"+r" (p), "+r" (cmpval), "+r" (val) : : "memory");
+ return (done);
+
}
#else /* !FreeBSD */
OpenPOWER on IntegriCloud