From 6fe23f8f339e5d0aeea0bc5ef62566a70a84f117 Mon Sep 17 00:00:00 2001 From: verbguy Date: Tue, 10 Nov 2009 15:53:38 +0000 Subject: [PATCH] commit missing Solaris inline assembly routines - SPARC and AMD64 --- builds/posix/make.defaults | 4 +++ builds/posix/prefix.solaris | 2 +- configure.in | 3 +++ src/common/classes/fb_cas.il | 43 ++++++++++++++++++++++++++++++++ src/common/classes/fb_cas_sax.il | 38 ++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 src/common/classes/fb_cas.il create mode 100644 src/common/classes/fb_cas_sax.il diff --git a/builds/posix/make.defaults b/builds/posix/make.defaults index 94ce812697..82a276a45d 100755 --- a/builds/posix/make.defaults +++ b/builds/posix/make.defaults @@ -119,6 +119,10 @@ TLS_OPTIONS=@TLS_OPTIONS@ # atomic options - set by configure ATOMIC_OPTIONS=@ATOMIC_OPTIONS@ +# compare and swap options - set by configure +# needed at least for solaris inline assembly routines +CAS_OPTIONS=@CAS_OPTIONS@ + # Default programs and tools to be used in the build process SH= sh -c diff --git a/builds/posix/prefix.solaris b/builds/posix/prefix.solaris index 3da6107950..5ac5259757 100644 --- a/builds/posix/prefix.solaris +++ b/builds/posix/prefix.solaris @@ -54,7 +54,7 @@ # libC and libCrun need libthread for a multithreaded application COMMON_FLAGS= -DSOLARIS -DBSD_COMP -D__EXTENSIONS__ \ -D_POSIX_THREAD_SEMANTICS -D_POSIX_THREAD_PRIO_INHERIT -D_POSIX_C_SOURCE=199506L \ - -KPIC \ + -KPIC $(CAS_OPTIONS) \ -erroff=wvarhidemem $(ATOMIC_OPTIONS) # if we keep sfio this needs to be set by configure (or move in to extern directory) diff --git a/configure.in b/configure.in index 465f5d7db1..9a866653e9 100644 --- a/configure.in +++ b/configure.in @@ -325,6 +325,7 @@ dnl CPU_TYPE=ppc64 if test "$isa" = "amd64"; then libdir=/usr/lib/amd64 fi + CAS_OPTIONS=`pwd`"/src/common/classes/fb_cas_sax.il"; INSTALL_PREFIX=solaris PLATFORM=solx86 AC_DEFINE(solx86, 1, [Define this if OS is Solarix x86]) @@ -348,6 +349,7 @@ dnl CPU_TYPE=ppc64 *) MAKEFILE_PREFIX=solaris-64gcc ; ICU_PLATFORM=SOLARISGCC ;; esac + CAS_OPTIONS=`pwd`"/src/common/classes/fb_cas.il"; INSTALL_PREFIX=solaris PLATFORM=SOLARIS AC_DEFINE(SOLARIS, 1, [Define this if OS is Solaris Sparc]) @@ -946,6 +948,7 @@ AC_COMPILE_IFELSE( CXXFLAGS=$pre_tls_cxxflags AC_SUBST(TLS_OPTIONS) AC_SUBST(ATOMIC_OPTIONS) +AC_SUBST(CAS_OPTIONS) dnl ##################### DO NOT ADD ANY TESTS BELOW ########################### diff --git a/src/common/classes/fb_cas.il b/src/common/classes/fb_cas.il new file mode 100644 index 0000000000..5003edf5a2 --- /dev/null +++ b/src/common/classes/fb_cas.il @@ -0,0 +1,43 @@ +/* + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/idpl.html. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The contents of this file or any work derived from this file + * may not be distributed under any other license whatsoever + * without the express prior written permission of the original + * author. + * + * + * The Original Code was created by James A. Starkey for IBPhoenix. + * + * Copyright (c) 2004 James A. Starkey + * All Rights Reserved. + */ + + .inline cas,3 + cas [%o0],%o1,%o2 + mov %o2,%o0 + .end + + .inline casx,3 + casx [%o0],%o1,%o2 + mov %o2,%o0 + .end + + .inline membar_flush,0 + membar 0x32 /* cmask = MemIssue | Lookaside, mmask = StoreLoad */ + .end + + .inline membar_wait,0 + membar 0x32 /* cmask = MemIssue | Lookaside, mmask = StoreLoad */ + .end + diff --git a/src/common/classes/fb_cas_sax.il b/src/common/classes/fb_cas_sax.il new file mode 100644 index 0000000000..3277b22344 --- /dev/null +++ b/src/common/classes/fb_cas_sax.il @@ -0,0 +1,38 @@ +/* + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/idpl.html. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The contents of this file or any work derived from this file + * may not be distributed under any other license whatsoever + * without the express prior written permission of the original + * author. + * + * + * The Original Code was created by James A. Starkey for IBPhoenix. + * + * Copyright (c) 2004 James A. Starkey + * All Rights Reserved. + */ + + .inline cas,3 + movl %esi, %eax + movl (%rdi),%r11d + lock; cmpxchgl %edx, (%rdi) + movl %r11d, %eax + .end + + .inline casx,3 + movq %rsi, %rax + movq (%rdi),%r11 + lock; cmpxchgq %rdx, (%rdi) + movq %r11, %rax + .end