aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2006-05-17 23:57:03 +0000
committerBruce Momjian <bruce@momjian.us>2006-05-17 23:57:03 +0000
commit407885ea3b709c34abc4541dacba7b19e5fcf0b4 (patch)
treea65dbd495fa85c7cf13f488ddf5bcdb73e80e39d /src
parent0d02ef4be4ce975daf599b7cbd117142ee979f9f (diff)
downloadpostgresql-407885ea3b709c34abc4541dacba7b19e5fcf0b4.tar.gz
postgresql-407885ea3b709c34abc4541dacba7b19e5fcf0b4.zip
Add comments that Solaris Sun compiler only supports sparc9 ASM,
Diffstat (limited to 'src')
-rw-r--r--src/backend/port/tas/solaris_sparc.s17
-rw-r--r--src/include/storage/s_lock.h6
2 files changed, 22 insertions, 1 deletions
diff --git a/src/backend/port/tas/solaris_sparc.s b/src/backend/port/tas/solaris_sparc.s
index d35a854c181..59c44874998 100644
--- a/src/backend/port/tas/solaris_sparc.s
+++ b/src/backend/port/tas/solaris_sparc.s
@@ -16,6 +16,23 @@
.global pg_atomic_cas
pg_atomic_cas:
+ ! "cas" only works on sparcv9 chips, and requies a compiler
+ ! that is targeting sparcv9. It will fail on a compiler
+ ! targeting sparcv8, and of course will not be understood
+ ! by a sparcv8 CPU. If this fails on existing Solaris
+ ! systems, we need to use a !defined(__sparcv9) test
+ ! to fall back to the old "ldstub" call for sparcv8 compiles.
+ ! gcc continues to use "ldstub" because there is no indication
+ ! which sparc version it is targeting.
+ !
+ ! There actually is a trick for embedding "cas" for a compiler
+ ! that is targeting sparcv8:
+ !
+ ! http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libc/sparc/threads/sparc.il
+ !
+ ! This might work for sparc8:
+ ! ldstub [%o0],%o1 ! moves only a byte
+
cas [%o0],%o2,%o1
mov %o1,%o0
retl
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 67ac6190366..6a13565672e 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -66,7 +66,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.152 2006/04/29 11:55:19 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.153 2006/05/17 23:57:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -311,6 +311,10 @@ tas(volatile slock_t *lock)
{
register slock_t _res;
+ /*
+ * See comment in /pg/backend/port/tas/solaris_sparc.s for why this
+ * uses "ldstub", and that file uses "cas".
+ */
__asm__ __volatile__(
" ldstub [%2], %0 \n"
: "=r"(_res), "+m"(*lock)