]> git.ipfire.org Git - thirdparty/gcc.git/blame - libitm/config/x86/sjlj.S
Update copyright in libitm.
[thirdparty/gcc.git] / libitm / config / x86 / sjlj.S
CommitLineData
75f9527c 1/* Copyright (C) 2008-2013 Free Software Foundation, Inc.
0a35513e
AH
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#else
78 leal 4(%esp), %ecx
5752c591 79 movl 4(%esp), %eax
0a35513e 80 subl $28, %esp
4bdd090f 81 cfi_def_cfa_offset(32)
0a35513e
AH
82 movl %ecx, 8(%esp)
83 movl %ebx, 12(%esp)
84 movl %esi, 16(%esp)
85 movl %edi, 20(%esp)
86 movl %ebp, 24(%esp)
87 leal 8(%esp), %edx
59659b59 88#if defined HAVE_ATTRIBUTE_VISIBILITY || !defined __PIC__
0b41ebef 89 call SYM(GTM_begin_transaction)
59659b59
RO
90#elif defined __ELF__
91 call 1f
921: popl %ebx
93 addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
0b41ebef 94 call SYM(GTM_begin_transaction)@PLT
59659b59
RO
95 movl 12(%esp), %ebx
96#else
97# error "Unsupported PIC sequence"
98#endif
0a35513e 99 addl $28, %esp
4bdd090f 100 cfi_def_cfa_offset(4)
0a35513e 101#endif
0c609a21 102 ret
4bdd090f 103 cfi_endproc
9bdc6343 104
0b41ebef
IS
105 TYPE(_ITM_beginTransaction)
106 SIZE(_ITM_beginTransaction)
0a35513e 107
9bdc6343 108 .align 4
0b41ebef 109 .globl SYM(GTM_longjmp)
0a35513e 110
0b41ebef 111SYM(GTM_longjmp):
4bdd090f 112 cfi_startproc
0a35513e 113#ifdef __x86_64__
062f93f2 114 movq (%rsi), %rcx
9848887a
UB
115 movq 8(%rsi), %rbx
116 movq 16(%rsi), %rbp
117 movq 24(%rsi), %r12
118 movq 32(%rsi), %r13
119 movq 40(%rsi), %r14
120 movq 48(%rsi), %r15
1f319dba 121 movl %edi, %eax
72824d5e
RH
122 cfi_def_cfa(%rsi, 0)
123 cfi_offset(%rip, 56)
1f319dba 124 cfi_register(%rsp, %rcx)
72824d5e 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
72824d5e 133 cfi_def_cfa(%edx, 0)
d4a698d4 134 cfi_offset(%eip, 20)
1f319dba 135 cfi_register(%esp, %ecx)
72824d5e 136 movl %ecx, %esp
d4a698d4 137 jmp *20(%edx)
0a35513e 138#endif
4bdd090f 139 cfi_endproc
9bdc6343 140
0b41ebef
IS
141 TYPE(GTM_longjmp)
142 HIDDEN(GTM_longjmp)
143 SIZE(GTM_longjmp)
0a35513e 144
9bdc6343 145#ifdef __linux__
0a35513e 146.section .note.GNU-stack, "", @progbits
9bdc6343 147#endif