]>
Commit | Line | Data |
---|---|---|
83ffe9cd | 1 | /* Copyright (C) 2012-2023 Free Software Foundation, Inc. |
f3f5e3c3 EB |
2 | |
3 | This file is part of the GNU Transactional Memory Library (libitm). | |
4 | ||
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. | |
9 | ||
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 | |
13 | more details. | |
14 | ||
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. | |
18 | ||
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/>. */ | |
23 | ||
24 | #include "asmcfi.h" | |
25 | ||
26 | #ifdef __arch64__ | |
27 | # define WORD_SIZE 8 | |
28 | # define MIN_FRAME_SIZE 176 | |
29 | # define STACK_BIAS 2047 | |
30 | # define load ldx | |
31 | # define store stx | |
32 | #else | |
33 | # define WORD_SIZE 4 | |
34 | # define MIN_FRAME_SIZE 96 | |
35 | # define STACK_BIAS 0 | |
36 | # define load ld | |
37 | # define store st | |
38 | #endif | |
39 | ||
40 | /* Fields of the JmpBuf structure. */ | |
41 | #define JB_CFA 0 | |
42 | #define JB_PC 1 | |
43 | #define OFFSET(FIELD) ((FIELD) * WORD_SIZE) | |
44 | ||
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) | |
48 | ||
49 | .text | |
50 | .align 4 | |
51 | .globl _ITM_beginTransaction | |
52 | .type _ITM_beginTransaction, #function | |
53 | .proc 016 | |
54 | _ITM_beginTransaction: | |
55 | cfi_startproc | |
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 | |
66 | jmp %o7+8 | |
67 | add %sp, FRAME_SIZE, %sp | |
68 | cfi_def_cfa_offset(STACK_BIAS) | |
69 | cfi_endproc | |
70 | .size _ITM_beginTransaction, . - _ITM_beginTransaction | |
71 | ||
72 | .align 4 | |
73 | .globl GTM_longjmp | |
74 | #ifdef HAVE_ATTRIBUTE_VISIBILITY | |
75 | .hidden GTM_longjmp | |
76 | #endif | |
77 | .type GTM_longjmp, #function | |
78 | .proc 016 | |
79 | GTM_longjmp: | |
80 | cfi_startproc | |
81 | flushw | |
f3f5e3c3 | 82 | #if STACK_BIAS |
62513f7b EB |
83 | load [%o1 + OFFSET (JB_CFA)], %g1 |
84 | sub %g1, STACK_BIAS, %fp | |
85 | #else | |
86 | load [%o1 + OFFSET (JB_CFA)], %fp | |
f3f5e3c3 | 87 | #endif |
62513f7b | 88 | cfi_def_cfa(%fp, STACK_BIAS) |
f3f5e3c3 EB |
89 | load [%o1 + OFFSET (JB_PC)], %o7 |
90 | jmp %o7+8 | |
91 | restore %g0, %o0, %o0 | |
92 | cfi_endproc | |
93 | .size GTM_longjmp, . - GTM_longjmp | |
94 | ||
95 | #ifdef __linux__ | |
96 | .section .note.GNU-stack, "", @progbits | |
97 | #endif |