aboutsummaryrefslogtreecommitdiff
path: root/libitm
diff options
context:
space:
mode:
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2013-04-23 11:33:50 +0000
committerAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2013-04-23 11:33:50 +0000
commitd05f4d588724db7f02c971d8d53dd92a90da158e (patch)
treec1653f515fe48b846f760e7405e9ac00957c1f33 /libitm
parent5d5f6c553cbb47636c0a082e6738aab2a2ccb02d (diff)
2013-04-23 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/sjlj.S: New file. * config/s390/target.h: New file. * configure.tgt: Set options for S/390. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@198190 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm')
-rw-r--r--libitm/config/s390/sjlj.S108
-rw-r--r--libitm/config/s390/target.h55
-rw-r--r--libitm/configure.tgt4
3 files changed, 167 insertions, 0 deletions
diff --git a/libitm/config/s390/sjlj.S b/libitm/config/s390/sjlj.S
new file mode 100644
index 00000000000..592d9af2cfd
--- /dev/null
+++ b/libitm/config/s390/sjlj.S
@@ -0,0 +1,108 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ This file is part of the GNU Transactional Memory Library (libitm).
+
+ Libitm is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+
+#include "asmcfi.h"
+
+.text
+ .align 4
+.globl _ITM_beginTransaction
+ .type _ITM_beginTransaction, @function
+
+ /* _ITM_beginTransaction (int props); props -> r2 */
+_ITM_beginTransaction:
+ cfi_startproc
+#ifdef __s390x__
+ lgr %r3,%r15 /* backup stack pointer */
+ aghi %r15,-304 /* jump buffer (144) + reg save area (160) */
+ cfi_adjust_cfa_offset(304)
+ stmg %r6,%r14,160(%r15)
+ stg %r3,72+160(%r15) /* store the old stack pointer */
+ std %f8,80+160(%r15)
+ std %f9,88+160(%r15)
+ std %f10,96+160(%r15)
+ std %f11,104+160(%r15)
+ std %f12,112+160(%r15)
+ std %f13,120+160(%r15)
+ std %f14,128+160(%r15)
+ std %f15,136+160(%r15)
+ la %r3,160(%r15) /* second argument to GTM_begin_transaction */
+ brasl %r14,GTM_begin_transaction
+ lg %r1,64+160(%r15)
+ aghi %r15,304
+ cfi_adjust_cfa_offset(-304)
+ br %r1
+#else
+ lr %r3,%r15 /* backup stack pointer */
+ ahi %r15,-152 /* jump buffer (56) + reg save area (96) */
+ cfi_adjust_cfa_offset(152)
+ stm %r6,%r14,96(%r15)
+ st %r3,36+96(%r15) /* store the old stack pointer */
+ std %f4,40+96(%r15)
+ std %f6,48+96(%r15)
+ la %r3,96(%r15) /* second argument to GTM_begin_transaction */
+ /* begin_transaction (uint32_t prop, const gtm_jmpbuf *jb) */
+ brasl %r14,GTM_begin_transaction /* requires mzarch */
+ l %r1,32+96(%r15)
+ ahi %r15,152
+ cfi_adjust_cfa_offset(-152)
+ br %r1
+#endif
+ cfi_endproc
+
+ .size _ITM_beginTransaction, .-_ITM_beginTransaction
+
+ .align 4
+.globl GTM_longjmp
+ .type GTM_longjmp, @function
+ .hidden GTM_longjmp
+
+ /* uint32_t GTM_longjmp (uint32_t, const gtm_jmpbuf *, uint32_t) */
+GTM_longjmp:
+ /* First parameter becomes the return value of
+ _ITM_beginTransaction (r2).
+ Third parameter is ignored for now. */
+ cfi_startproc
+#ifdef __s390x__
+ ld %f8,80(%r3)
+ ld %f9,88(%r3)
+ ld %f10,96(%r3)
+ ld %f11,104(%r3)
+ ld %f12,112(%r3)
+ ld %f13,120(%r3)
+ ld %f14,128(%r3)
+ ld %f15,136(%r3)
+ lmg %r6,%r15,0(%r3)
+ br %r14
+#else
+ ld %f4,40(%r3)
+ ld %f6,48(%r3)
+ lm %r6,%r15,0(%r3)
+ br %r14
+#endif
+ cfi_endproc
+
+ .size GTM_longjmp, .-GTM_longjmp
+
+ .section .note.GNU-stack, "", @progbits
diff --git a/libitm/config/s390/target.h b/libitm/config/s390/target.h
new file mode 100644
index 00000000000..a102e1e3d3d
--- /dev/null
+++ b/libitm/config/s390/target.h
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <krebbel@linux.vnet.ibm.com>.
+
+ This file is part of the GNU Transactional Memory Library (libitm).
+
+ Libitm is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+namespace GTM HIDDEN {
+
+#define HW_CACHELINE_SIZE 256
+
+typedef struct gtm_jmpbuf
+{
+ /* We save registers r6-r14. */
+ long int __gregs[9];
+ /* r15 is stored into cfa field. It needs to be named that way
+ since tls.h is accessing the field by name. Be aware that this
+ is not actually what we consider the CFA on s390 (since there is
+ a fix offset between sp and CFA). It is merely the saved stack
+ pointer. */
+ void *cfa;
+
+#ifdef __s390x__
+ /* We save fpu registers f8 - f15. */
+ long __fpregs[8];
+#else
+ /* We save fpu registers f4 and f6. */
+ long __fpregs[4];
+#endif
+} gtm_jmpbuf;
+
+static inline void
+cpu_relax (void)
+{
+ __asm volatile ("" : : : "memory");
+}
+
+} // namespace GTM
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
index 84824ca16f0..ab3953b16d7 100644
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -105,6 +105,10 @@ case "${target_cpu}" in
XCFLAGS="${XCFLAGS} -mrtm"
ARCH=x86
;;
+ s390|s390x)
+ ARCH=s390
+ XCFLAGS="${XCFLAGS} -mzarch"
+ ;;
*)
ARCH="${target_cpu}"