1 /* Copyright (C) 2011-2024 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(__FDPIC__)
53 .macro ldaddr reg, addr
58 99: .word \addr(GOTOFF)
61 #elif defined(HAVE_MOVT) && defined(PIC)
62 .macro ldaddr reg, addr
63 movw \reg, #:lower16:(\addr - (98f + PC_OFS))
64 movt \reg, #:upper16:(\addr - (98f + PC_OFS))
65 98: add \reg, \reg, pc
67 #elif defined(HAVE_MOVT)
68 .macro ldaddr reg, addr
69 movw \reg, #:lower16:\addr
70 movt \reg, #:upper16:\addr
73 .macro ldaddr reg, addr
75 98: add \reg, \reg, pc
78 99: .word \addr - (98b + PC_OFS)
82 .macro ldaddr reg, addr
89 .global _ITM_beginTransaction
90 .type _ITM_beginTransaction, %function
92 _ITM_beginTransaction:
96 push { r4-r11, ip, lr }
99 cfi_adjust_cfa_offset(40)
100 cfi_rel_offset(lr, 36)
103 cfi_adjust_cfa_offset(14*8)
108 /* Store the VFP registers. Don't use VFP instructions directly
109 because this code is used in non-VFP multilibs. */
110 tst r2, #HWCAP_ARM_VFP
112 stc p11, cr8, [sp], {16} /* vstm sp, {d8-d15} */
114 /* Save the call-preserved iWMMXt registers. */
115 tst r2, #HWCAP_ARM_IWMMXT
117 stcl p1, cr10, [sp, #64] /* wstrd wr10, [sp, #64] */
118 stcl p1, cr11, [sp, #72]
119 stcl p1, cr12, [sp, #80]
120 stcl p1, cr13, [sp, #88]
121 stcl p1, cr14, [sp, #96]
122 stcl p1, cr15, [sp, #104]
124 /* Invoke GTM_begin_transaction with the struct we just built. */
126 bl GTM_begin_transaction
128 /* Return; we don't need to restore any of the call-saved regs. */
129 add sp, sp, #(14*8 + 9*4)
130 cfi_adjust_cfa_offset(-(14*8 + 9*4))
134 .size _ITM_beginTransaction, . - _ITM_beginTransaction
139 .type GTM_longjmp, %function
146 tst r2, #HWCAP_ARM_VFP
148 ldc p11, cr8, [r1], {16} /* vldmia r1, {d8-d15} */
150 tst r2, #HWCAP_ARM_IWMMXT
152 ldcl p1, cr10, [r1, #64] /* wldrd wr10, [r1, #64] */
153 ldcl p1, cr11, [r1, #72]
154 ldcl p1, cr12, [r1, #80]
155 ldcl p1, cr13, [r1, #88]
156 ldcl p1, cr14, [r1, #96]
157 ldcl p1, cr15, [r1, #104]
159 add r1, r1, #(14*8) /* Skip both VFP and iWMMXt blocks */
161 ldm r1, { r4-r11, ip, lr }
166 ldm r1, { r4-r11, sp, pc }
169 .size GTM_longjmp, . - GTM_longjmp
172 .section .note.GNU-stack, "", %progbits