1 /* Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 This file is part of the GNU Transactional Memory Library (libitm).
5 Libitm is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
28 # define MIN_FRAME_SIZE 176
29 # define STACK_BIAS 2047
34 # define MIN_FRAME_SIZE 96
40 /* Fields of the JmpBuf structure. */
43 #define OFFSET(FIELD) ((FIELD) * WORD_SIZE)
45 /* The frame size must be a multiple of the double-word size. */
46 #define FRAME_SIZE (MIN_FRAME_SIZE + 2 * WORD_SIZE)
47 #define JB_OFFSET (STACK_BIAS + MIN_FRAME_SIZE)
51 .globl _ITM_beginTransaction
52 .type _ITM_beginTransaction, #function
54 _ITM_beginTransaction:
56 add %sp, STACK_BIAS, %g1
57 sub %sp, FRAME_SIZE, %sp
58 cfi_def_cfa_offset(STACK_BIAS + FRAME_SIZE)
59 store %g1, [%sp + JB_OFFSET + OFFSET (JB_CFA)]
60 store %o7, [%sp + JB_OFFSET + OFFSET (JB_PC)]
61 /* ??? This triggers an internal error in GDB. */
62 cfi_offset(%o7, -WORD_SIZE)
63 call GTM_begin_transaction
64 add %sp, JB_OFFSET, %o1
65 load [%sp + JB_OFFSET + OFFSET (JB_PC)], %o7
67 add %sp, FRAME_SIZE, %sp
68 cfi_def_cfa_offset(STACK_BIAS)
70 .size _ITM_beginTransaction, . - _ITM_beginTransaction
74 #ifdef HAVE_ATTRIBUTE_VISIBILITY
77 .type GTM_longjmp, #function
83 load [%o1 + OFFSET (JB_CFA)], %g1
84 sub %g1, STACK_BIAS, %fp
86 load [%o1 + OFFSET (JB_CFA)], %fp
88 cfi_def_cfa(%fp, STACK_BIAS)
89 load [%o1 + OFFSET (JB_PC)], %o7
93 .size GTM_longjmp, . - GTM_longjmp
96 .section .note.GNU-stack, "", @progbits