File tree 6 files changed +71
-157
lines changed
6 files changed +71
-157
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- !!
2
- !! $ PostgreSQL: pgsql/src/backend/port/tas/solaris_sparc.s , v 1 . 2 2003 / 11 / 29 19 : 51 : 54 pgsql Exp $
3
- !!
4
- !! this would be a piece of inlined assembler but it appears
5
- !! to be easier to just write the assembler than to try to
6
- !! figure out how to make sure th at in/ out registers are kept
7
- !! straight in the asm's.
8
- !!
9
- .file "tas.c"
10
- . section ".text"
11
- . align 4
12
- . global tas
13
- .type tas , #function
14
- .proc 04
15
- tas:
16
- !!
17
- !! this is a leaf procedure - no need to save windows and
18
- !! diddle the CWP.
19
- !!
20
- !#PROLOGUE# 0
21
- !#PROLOGUE# 1
22
-
23
- !!
24
- !! write 0xFF into the lock address , saving the old value in %o0.
25
- !! this is an atomic action , even on multiprocessors.
26
- !!
27
- ldstub [ %o0 ], %o0
28
-
29
- !!
30
- !! if it was already set when we set it , somebody else already
31
- !! owned the lock -- return 1 .
32
- !!
33
- cmp %o0 , 0
34
- bne .LL2
35
- mov 1 , %o0
36
-
37
- !!
38
- !! otherwise , it was clear and we now own the lock -- return 0 .
39
- !!
40
- mov 0 , %o0
41
- .LL2:
42
- !!
43
- !! this is a leaf procedure - no need to restore windows and
44
- !! diddle the CWP.
45
- !!
46
- retl
47
- nop
48
- .LLfe1:
49
- .size tas , .LLfe1 - tas
50
- .ident "GCC: (GNU) 2.5.8"
1
+ /=======================================================================
2
+ / solaris_sparc.s -- compare and swap for solaris_sparc
3
+ /=======================================================================
4
+
5
+ #if defined(__sparcv9) || defined(__sparc)
6
+
7
+ .section ".text"
8
+ .align 8
9
+ .skip 24
10
+ .align 4
11
+
12
+ .global pg_atomic_cas
13
+ pg_atomic_cas:
14
+ cas [%o0],%o2,%o1
15
+ mov %o1,%o0
16
+ retl
17
+ nop
18
+ .type pg_atomic_cas,2
19
+ .size pg_atomic_cas,(.-pg_atomic_cas)
20
+ #endif
Original file line number Diff line number Diff line change
1
+ /=======================================================================
2
+ / solaris_i386.s -- compare and swap for solaris_i386
3
+ /=======================================================================
4
+
5
+ / Fortunately the Sun compiler understands cpp conditionals
6
+
7
+ .file "tas.s"
8
+
9
+ #if defined(__amd64)
10
+ .code64
11
+ #endif
12
+
13
+ .globl pg_atomic_cas
14
+ .type pg_atomic_cas, @function
15
+
16
+ .section .text , "ax"
17
+ .align 16
18
+
19
+ pg_atomic_cas:
20
+ #if defined(__amd64)
21
+ movl %edx ,%eax
22
+ lock
23
+ cmpxchgl %esi ,(%rdi )
24
+ #else
25
+ movl 4 (%esp ), %edx
26
+ movl 8 (%esp ), %ecx
27
+ movl 12 (%esp ), %eax
28
+ lock
29
+ cmpxchgl %ecx , (%edx )
30
+ #endif
31
+ ret
32
+ .size pg_atomic_cas, . - pg_atomic_cas
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 66
66
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
67
67
* Portions Copyright (c) 1994, Regents of the University of California
68
68
*
69
- * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.149 2006/04/19 23:11:15 tgl Exp $
69
+ * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.150 2006/04/27 22:28:42 momjian Exp $
70
70
*
71
71
*-------------------------------------------------------------------------
72
72
*/
@@ -763,23 +763,14 @@ typedef unsigned char slock_t;
763
763
#endif
764
764
765
765
766
- #if defined(__sparc__ ) || defined(__sparc )
766
+ #if defined(__sun ) && (defined( __i386 ) || defined( __x86_64__ ) || defined( __sparc__ ) || defined(__sparc ) )
767
767
#define HAS_TEST_AND_SET
768
-
769
768
typedef unsigned char slock_t ;
770
- #endif
771
-
772
-
773
- /* out-of-line assembler from src/backend/port/tas/foo.s */
774
769
775
- /* i386/X86_64 using Sun compiler */
776
- #if defined(__sun ) && (defined(__i386 ) || defined(__x86_64__ ))
777
- /*
778
- * Solaris/386 (we only get here for non-gcc case)
779
- */
780
- #define HAS_TEST_AND_SET
770
+ extern volatile slock_t pg_atomic_cas (volatile slock_t * lock , slock_t with ,
771
+ slock_t cmp );
781
772
782
- typedef unsigned char slock_t ;
773
+ #define TAS ( a ) (pg_atomic_cas((a), 1, 0) != 0)
783
774
#endif
784
775
785
776
Original file line number Diff line number Diff line change @@ -4,29 +4,21 @@ if test "$GCC" != yes ; then
4
4
if test "$enable_debug" != yes; then
5
5
CFLAGS="$CFLAGS -O" # any optimization breaks debug
6
6
fi
7
- fi
8
-
9
- # Pick right test-and-set (TAS) code. We need out-of-line assembler
10
- # when not using gcc.
11
- case $host in
12
- sparc-*-solaris*)
13
- if test "$GCC" != yes ; then
14
- need_tas=yes
15
- tas_file=solaris_sparc.s
16
- fi
7
+ else
8
+ # Pick the right test-and-set (TAS) code for the Sun compiler.
9
+ # We would like to use in-line assembler, but the compiler
10
+ # requires *.il files to be on every compile line, making
11
+ # the build system too fragile.
12
+ case $host in
13
+ sparc-*-solaris*)
14
+ need_tas=yes
15
+ tas_file=solaris_sparc.s
17
16
;;
18
- i?86-*-solaris*)
19
- if test "$GCC" != yes ; then
20
- if isainfo | grep amd64
21
- then
22
- need_tas=yes
23
- tas_file=solaris_x86_64.s
24
- else
25
- need_tas=yes
26
- tas_file=solaris_i386.s
27
- fi
28
- fi
17
+ i?86-*-solaris*)
18
+ need_tas=yes
19
+ tas_file=solaris_x86.s
29
20
;;
30
- esac
21
+ esac
22
+ fi
31
23
32
24
# -D_POSIX_PTHREAD_SEMANTICS enables 5-arg getpwuid_r, among other things
You can’t perform that action at this time.
0 commit comments