Skip to content

Commit 407885e

Browse files
committed
Add comments that Solaris Sun compiler only supports sparc9 ASM,
1 parent 0d02ef4 commit 407885e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/backend/port/tas/solaris_sparc.s

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@
1616
.global pg_atomic_cas
1717
pg_atomic_cas:
1818

19+
! "cas" only works on sparcv9 chips, and requies a compiler
20+
! that is targeting sparcv9. It will fail on a compiler
21+
! targeting sparcv8, and of course will not be understood
22+
! by a sparcv8 CPU. If this fails on existing Solaris
23+
! systems, we need to use a !defined(__sparcv9) test
24+
! to fall back to the old "ldstub" call for sparcv8 compiles.
25+
! gcc continues to use "ldstub" because there is no indication
26+
! which sparc version it is targeting.
27+
!
28+
! There actually is a trick for embedding "cas" for a compiler
29+
! that is targeting sparcv8:
30+
!
31+
! http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libc/sparc/threads/sparc.il
32+
!
33+
! This might work for sparc8:
34+
! ldstub [%o0],%o1 ! moves only a byte
35+
1936
cas [%o0],%o2,%o1
2037
mov %o1,%o0
2138
retl

src/include/storage/s_lock.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
6767
* Portions Copyright (c) 1994, Regents of the University of California
6868
*
69-
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.152 2006/04/29 11:55:19 momjian Exp $
69+
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.153 2006/05/17 23:57:03 momjian Exp $
7070
*
7171
*-------------------------------------------------------------------------
7272
*/
@@ -311,6 +311,10 @@ tas(volatile slock_t *lock)
311311
{
312312
register slock_t _res;
313313

314+
/*
315+
* See comment in /pg/backend/port/tas/solaris_sparc.s for why this
316+
* uses "ldstub", and that file uses "cas".
317+
*/
314318
__asm__ __volatile__(
315319
" ldstub [%2], %0 \n"
316320
: "=r"(_res), "+m"(*lock)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy