aboutsummaryrefslogtreecommitdiff
path: root/src/backend/port/sparc_solaris/tas.s
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1996-07-09 06:22:35 +0000
committerMarc G. Fournier <scrappy@hub.org>1996-07-09 06:22:35 +0000
commitd31084e9d1118b25fd16580d9d8c2924b5740dff (patch)
tree3179e66307d54df9c7b966543550e601eb55e668 /src/backend/port/sparc_solaris/tas.s
downloadpostgresql-PG95-1_01.tar.gz
postgresql-PG95-1_01.zip
Postgres95 1.01 Distribution - Virgin SourcesPG95-1_01
Diffstat (limited to 'src/backend/port/sparc_solaris/tas.s')
-rw-r--r--src/backend/port/sparc_solaris/tas.s50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/backend/port/sparc_solaris/tas.s b/src/backend/port/sparc_solaris/tas.s
new file mode 100644
index 00000000000..e09c2d4ad3c
--- /dev/null
+++ b/src/backend/port/sparc_solaris/tas.s
@@ -0,0 +1,50 @@
+ !!
+ !! $Header: /cvsroot/pgsql/src/backend/port/sparc_solaris/Attic/tas.s,v 1.1.1.1 1996/07/09 06:21:45 scrappy Exp $
+ !!
+ !! this would be a piece of inlined assembler but it appears
+ !! to be easier to just write the assembler than to try to
+ !! figure out how to make sure that in/out registers are kept
+ !! straight in the asm's.
+ !!
+ .file "tas.c"
+.section ".text"
+ .align 4
+ .global tas
+ .type tas,#function
+ .proc 04
+tas:
+ !!
+ !! this is a leaf procedure - no need to save windows and
+ !! diddle the CWP.
+ !!
+ !#PROLOGUE# 0
+ !#PROLOGUE# 1
+
+ !!
+ !! write 0xFF into the lock address, saving the old value in %o0.
+ !! this is an atomic action, even on multiprocessors.
+ !!
+ ldstub [%o0],%o0
+
+ !!
+ !! if it was already set when we set it, somebody else already
+ !! owned the lock -- return 1.
+ !!
+ cmp %o0,0
+ bne .LL2
+ mov 1,%o0
+
+ !!
+ !! otherwise, it was clear and we now own the lock -- return 0.
+ !!
+ mov 0,%o0
+.LL2:
+ !!
+ !! this is a leaf procedure - no need to restore windows and
+ !! diddle the CWP.
+ !!
+ retl
+ nop
+.LLfe1:
+ .size tas,.LLfe1-tas
+ .ident "GCC: (GNU) 2.5.8"