summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorianh <ianh@13f79535-47bb-0310-9956-ffa450edef68>2002-02-19 23:45:06 +0000
committerianh <ianh@13f79535-47bb-0310-9956-ffa450edef68>2002-02-19 23:45:06 +0000
commit70212b146b2823174a0b801096c81b05453aeafb (patch)
tree07281204823fc7fa3c129867165cb2af262efabd
parent6e81a9cc203db8d97fdccc356c8840c764356976 (diff)
downloadlibapr-70212b146b2823174a0b801096c81b05453aeafb.tar.gz
enable sun-sparc specific code
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63028 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--atomic/solaris_sparc/apr_atomic_sparc.s37
-rw-r--r--configure.in12
-rw-r--r--include/apr_atomic.h2
-rw-r--r--test/testatomic.c1
4 files changed, 43 insertions, 9 deletions
diff --git a/atomic/solaris_sparc/apr_atomic_sparc.s b/atomic/solaris_sparc/apr_atomic_sparc.s
index f17cb2bbe..95f438d81 100644
--- a/atomic/solaris_sparc/apr_atomic_sparc.s
+++ b/atomic/solaris_sparc/apr_atomic_sparc.s
@@ -71,19 +71,20 @@
!
ENTRY(apr_atomic_add_sparc)
- ld [%o0], %o2
+ ld [%o0], %o2 ! set o2 to current value
_apr_atomic_add_sparc_loop:
- add %o2, %o1, %o3
- cas [%o0], %o2, %o3
- cmp %o2, %o3
- bne,a _apr_atomic_add_sparc_loop
- ld [%o0], %o2
+ add %o2, %o1, %o3 ! o3 = o2 + o1
+ cas [%o0], %o2, %o3 ! if cur-val==o2 then cur-val=03
+ cmp %o2, %o3 ! see if the CAS worked
+ bne,a _apr_atomic_add_sparc_loop ! if not try again
+ ld [%o0], %o2 ! return the previous value
retl
mov %o3, %o0
SET_SIZE(apr_atomic_add_sparc)
!
!
+!
ENTRY(apr_atomic_sub_sparc)
ld [%o0], %o2
@@ -96,5 +97,27 @@ _apr_atomic_sub_sparc_loop:
retl
mov %o3, %o0
- SET_SIZE(apr_atomic_sub_sparc)
+ SET_SIZE(apr_atomic_sub_sparc)
+!
+!
+!
+! %o0 [input] - the address of the value to compare
+! %o1 [input] - the new value
+! %o2 [input] - value to compare against
+! %o0 [output] - the return value
+!
+ ENTRY(apr_atomic_cas_sparc)
+ ENTRY(apr_atomic_casptr_sparc)
+
+ cas [%o0], %o2, %o1
+ cmp %o1, %o2 ! if o1 == o2 values weren't swapped
+ bne,a _apr_atomic_cas_ne
+ mov %o2, %o0
+ retl
+ mov %o2, %o0
+_apr_atomic_cas_ne:
+ retl
+ mov %o1, %o0
+
+ SET_SIZE(apr_atomic_cas_sparc)
diff --git a/configure.in b/configure.in
index c4bc1508c..6800ab517 100644
--- a/configure.in
+++ b/configure.in
@@ -322,6 +322,18 @@ case $host in
enable_threads="no"
eolstr="\\n"
;;
+ *sun*)
+ case $host_cpu in
+ *sparc*)
+ OSDIR="solaris_sparc"
+ eolstr="\\n"
+ ;;
+ *)
+ OSDIR="unix"
+ eolstr="\\n"
+ ;;
+ esac
+ ;;
*)
OSDIR="unix"
eolstr="\\n"
diff --git a/include/apr_atomic.h b/include/apr_atomic.h
index 2dd0ceb1d..b4fd25219 100644
--- a/include/apr_atomic.h
+++ b/include/apr_atomic.h
@@ -173,7 +173,7 @@ long apr_atomic_cas(volatile apr_atomic_t *mem,long with,long cmp);
#define APR_ATOMIC_NEED_CAS_DEFAULT 1
-#elif defined(__sparc__not_yet)
+#elif defined(__sparc__)
#define apr_atomic_t apr_uint32_t
#define apr_atomic_read(p) *p
diff --git a/test/testatomic.c b/test/testatomic.c
index 7f985d701..00e6f7278 100644
--- a/test/testatomic.c
+++ b/test/testatomic.c
@@ -83,7 +83,6 @@ static apr_status_t check_basic_atomics(volatile apr_atomic_t*p)
return APR_EGENERAL;
}
printf("OK\n");
- printf("debug\n y=%d\n",y);
printf("%-60s", "testing CAS - match non-null");
oldval = apr_atomic_cas(&y,23,12);
if (oldval != 12) {