1 /* Copyright (C) 2011-2013 Free Software Foundation, Inc.
2 Contributed by Richard Henderson <rth@redhat.com>.
4 This file is part of the GNU Transactional Memory Library (libitm).
6 Libitm is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
30 #if defined(__thumb2__)
38 #if defined (__thumb2__) && defined(__ARM_ARCH_6T2__)
41 #elif defined (__ARM_ARCH_7A__)
44 #elif defined (__ARM_ARCH_7R__)
47 #elif defined (__ARM_ARCH_7M__)
52 #if defined(HAVE_MOVT) && defined(PIC)
53 .macro ldaddr reg, addr
54 movw \reg, #:lower16:(\addr - (98f + PC_OFS))
55 movt \reg, #:upper16:(\addr - (98f + PC_OFS))
56 98: add \reg, \reg, pc
58 #elif defined(HAVE_MOVT)
59 .macro ldaddr reg, addr
60 movw \reg, #:lower16:\addr
61 movt \reg, #:upper16:\addr
64 .macro ldaddr reg, addr
66 98: add \reg, \reg, pc
69 99: .word \addr - (98b + PC_OFS)
73 .macro ldaddr reg, addr
80 .global _ITM_beginTransaction
81 .type _ITM_beginTransaction, %function
83 _ITM_beginTransaction:
87 push { r4-r11, ip, lr }
90 cfi_adjust_cfa_offset(40)
91 cfi_rel_offset(lr, 36)
94 cfi_adjust_cfa_offset(14*8)
99 /* Store the VFP registers. Don't use VFP instructions directly
100 because this code is used in non-VFP multilibs. */
101 tst r2, #HWCAP_ARM_VFP
103 stc p11, cr8, [sp], {16} /* vstm sp, {d8-d15} */
105 /* Save the call-preserved iWMMXt registers. */
106 tst r2, #HWCAP_ARM_IWMMXT
108 stcl p1, cr10, [sp, #64] /* wstrd wr10, [sp, #64] */
109 stcl p1, cr11, [sp, #72]
110 stcl p1, cr12, [sp, #80]
111 stcl p1, cr13, [sp, #88]
112 stcl p1, cr14, [sp, #96]
113 stcl p1, cr15, [sp, #104]
115 /* Invoke GTM_begin_transaction with the struct we just built. */
117 bl GTM_begin_transaction
119 /* Return; we don't need to restore any of the call-saved regs. */
120 add sp, sp, #(14*8 + 9*4)
121 cfi_adjust_cfa_offset(-(14*8 + 9*4))
125 .size _ITM_beginTransaction, . - _ITM_beginTransaction
130 .type GTM_longjmp, %function
137 tst r2, #HWCAP_ARM_VFP
139 ldc p11, cr8, [r1], {16} /* vldmia r1, {d8-d15} */
141 tst r2, #HWCAP_ARM_IWMMXT
143 ldcl p1, cr10, [r1, #64] /* wldrd wr10, [r1, #64] */
144 ldcl p1, cr11, [r1, #72]
145 ldcl p1, cr12, [r1, #80]
146 ldcl p1, cr13, [r1, #88]
147 ldcl p1, cr14, [r1, #96]
148 ldcl p1, cr15, [r1, #104]
150 add r1, r1, #(14*8) /* Skip both VFP and iWMMXt blocks */
152 ldm r1, { r4-r11, ip, lr }
157 ldm r1, { r4-r11, sp, pc }
160 .size GTM_longjmp, . - GTM_longjmp
163 .section .note.GNU-stack, "", %progbits