summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2005-12-30 21:43:41 +0000
committerBruce Momjian2005-12-30 21:43:41 +0000
commit5ab97d8496ef1bc1e17a219a26f688a81c425e8b (patch)
tree7a908de5c4caaa5961ffe3eee0ed2149be573f9b
parentdceb2be682238545bf949b678c10b7154cc60453 (diff)
Add support for Solaris x86_64 using Sun's compiler.
Pierre Girard
-rw-r--r--src/Makefile.shlib2
-rw-r--r--src/backend/port/tas/solaris_x86_64.s35
-rw-r--r--src/include/storage/s_lock.h3
-rw-r--r--src/template/solaris11
4 files changed, 47 insertions, 4 deletions
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index ee33a68e7e..7a51e25891 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -193,7 +193,7 @@ ifeq ($(PORTNAME), solaris)
ifeq ($(GCC), yes)
LINK.shared = $(CC) -shared
else
- LINK.shared = $(CC) -G
+ LINK.shared = $(CC) -G $(CFLAGS) # CFLAGS added for X86_64
endif
ifeq ($(with_gnu_ld), yes)
LINK.shared += -Wl,-soname,$(soname)
diff --git a/src/backend/port/tas/solaris_x86_64.s b/src/backend/port/tas/solaris_x86_64.s
new file mode 100644
index 0000000000..4fad43e5a2
--- /dev/null
+++ b/src/backend/port/tas/solaris_x86_64.s
@@ -0,0 +1,35 @@
+/=============================================================================
+/ tas.s -- test and set lock for solaris_i386
+/ based on i386 ASM with modifications outlined in
+/ http://www.x86-64.org/documentation/assembly
+/=============================================================================
+
+ .file "tas.s"
+ .text
+ .align 16
+.L1.text:
+
+ .globl tas
+tas:
+ pushq %rbp /save prev base pointer
+ movq %rsp,%rbp /new base pointer
+ pushq %rbx /save prev bx
+ movq 8(%rbp),%rbx /load bx with address of lock
+ movq $255,%rax /put something in ax
+ xchgb %al,(%rbx) /swap lock value with "0"
+ cmpb $0,%al /did we get the lock?
+ jne .Locked
+ subq %rax,%rax /yes, we got it -- return 0
+ jmp .Finish
+ .align 8
+.Locked:
+ movq $1,%rax /no, we didn't get it - return 1
+.Finish:
+ popq %rbx /restore prev bx
+ movq %rbp,%rsp /restore stack state
+ popq %rbp
+ ret /return
+ .align 8
+ .type tas,@function
+ .size tas,.-tas
+
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index d644cfb40a..f789af4155 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -791,7 +791,8 @@ typedef unsigned char slock_t;
/* out-of-line assembler from src/backend/port/tas/foo.s */
-#if defined(__sun) && defined(__i386) /* i386 using Sun compiler */
+/* i386/X86_64 using Sun compiler */
+#if defined(__sun) && (defined(__i386) || defined(__x86_64__))
/*
* Solaris/386 (we only get here for non-gcc case)
*/
diff --git a/src/template/solaris b/src/template/solaris
index 785fc3ea13..4a9a5651bb 100644
--- a/src/template/solaris
+++ b/src/template/solaris
@@ -17,8 +17,15 @@ case $host in
;;
i?86-*-solaris*)
if test "$GCC" != yes ; then
- need_tas=yes
- tas_file=solaris_i386.s
+ soarch=`isainfo`
+ if isainfo | grep amd64
+ then
+ need_tas=yes
+ tas_file=solaris_x86_64.s
+ else
+ need_tas=yes
+ tas_file=solaris_i386.s
+ fi
fi
;;
esac