]> git.ipfire.org Git - thirdparty/gcc.git/blame - libitm/config/x86/sjlj.S
re PR go/48501 (64bit-out.go, select5-out.go, tmp.go compilation times out)
[thirdparty/gcc.git] / libitm / config / x86 / sjlj.S
CommitLineData
0a35513e
AH
1/* Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
2 Contributed by Richard Henderson <rth@redhat.com>.
3
4 This file is part of the GNU Transactional Memory Library (libitm).
5
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.
10
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
14 more details.
15
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.
19
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/>. */
24
4bdd090f
RH
25
26#include "asmcfi.h"
27
0b41ebef
IS
28#define CONCAT1(a, b) CONCAT2(a, b)
29#define CONCAT2(a, b) a ## b
30
31#ifdef __USER_LABEL_PREFIX__
32# define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
33#else
34# define SYM(x) x
35#endif
36
37#ifdef __ELF__
38# define TYPE(x) .type SYM(x), @function
39# define SIZE(x) .size SYM(x), . - SYM(x)
40# ifdef HAVE_ATTRIBUTE_VISIBILITY
41# define HIDDEN(x) .hidden SYM(x)
42# else
43# define HIDDEN(x)
44# endif
45#else
46# define TYPE(x)
47# define SIZE(x)
48# ifdef __MACH__
49# define HIDDEN(x) .private_extern SYM(x)
50# else
51# define HIDDEN(x)
52# endif
53#endif
54
0a35513e 55 .text
9bdc6343
RH
56
57 .align 4
0b41ebef 58 .globl SYM(_ITM_beginTransaction)
0a35513e 59
0b41ebef 60SYM(_ITM_beginTransaction):
4bdd090f 61 cfi_startproc
0a35513e
AH
62#ifdef __x86_64__
63 leaq 8(%rsp), %rax
9848887a
UB
64 subq $56, %rsp
65 cfi_def_cfa_offset(64)
0a35513e 66 movq %rax, (%rsp)
9848887a
UB
67 movq %rbx, 8(%rsp)
68 movq %rbp, 16(%rsp)
69 movq %r12, 24(%rsp)
70 movq %r13, 32(%rsp)
71 movq %r14, 40(%rsp)
72 movq %r15, 48(%rsp)
0a35513e 73 movq %rsp, %rsi
0b41ebef 74 call SYM(GTM_begin_transaction)
9848887a 75 addq $56, %rsp
4bdd090f 76 cfi_def_cfa_offset(8)
0a35513e
AH
77 ret
78#else
79 leal 4(%esp), %ecx
5752c591 80 movl 4(%esp), %eax
0a35513e 81 subl $28, %esp
4bdd090f 82 cfi_def_cfa_offset(32)
0a35513e
AH
83 movl %ecx, 8(%esp)
84 movl %ebx, 12(%esp)
85 movl %esi, 16(%esp)
86 movl %edi, 20(%esp)
87 movl %ebp, 24(%esp)
88 leal 8(%esp), %edx
59659b59 89#if defined HAVE_ATTRIBUTE_VISIBILITY || !defined __PIC__
0b41ebef 90 call SYM(GTM_begin_transaction)
59659b59
RO
91#elif defined __ELF__
92 call 1f
931: popl %ebx
94 addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
0b41ebef 95 call SYM(GTM_begin_transaction)@PLT
59659b59
RO
96 movl 12(%esp), %ebx
97#else
98# error "Unsupported PIC sequence"
99#endif
0a35513e 100 addl $28, %esp
4bdd090f 101 cfi_def_cfa_offset(4)
0a35513e
AH
102 ret
103#endif
4bdd090f 104 cfi_endproc
9bdc6343 105
0b41ebef
IS
106 TYPE(_ITM_beginTransaction)
107 SIZE(_ITM_beginTransaction)
0a35513e 108
9bdc6343 109 .align 4
0b41ebef 110 .globl SYM(GTM_longjmp)
0a35513e 111
0b41ebef 112SYM(GTM_longjmp):
4bdd090f 113 cfi_startproc
0a35513e 114#ifdef __x86_64__
062f93f2 115 movq (%rsi), %rcx
9848887a
UB
116 movq 8(%rsi), %rbx
117 movq 16(%rsi), %rbp
118 movq 24(%rsi), %r12
119 movq 32(%rsi), %r13
120 movq 40(%rsi), %r14
121 movq 48(%rsi), %r15
062f93f2 122 movl %edi, %eax
d4a698d4 123 cfi_offset(%rip, 56)
4bdd090f 124 cfi_def_cfa(%rcx, 0)
0a35513e 125 movq %rcx, %rsp
d4a698d4 126 jmp *56(%rsi)
0a35513e 127#else
0a35513e
AH
128 movl (%edx), %ecx
129 movl 4(%edx), %ebx
130 movl 8(%edx), %esi
131 movl 12(%edx), %edi
132 movl 16(%edx), %ebp
d4a698d4 133 cfi_offset(%eip, 20)
4bdd090f 134 cfi_def_cfa(%ecx, 0)
0a35513e 135 movl %ecx, %esp
d4a698d4 136 jmp *20(%edx)
0a35513e 137#endif
4bdd090f 138 cfi_endproc
9bdc6343 139
0b41ebef
IS
140 TYPE(GTM_longjmp)
141 HIDDEN(GTM_longjmp)
142 SIZE(GTM_longjmp)
0a35513e 143
9bdc6343 144#ifdef __linux__
0a35513e 145.section .note.GNU-stack, "", @progbits
9bdc6343 146#endif