OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libitm/] [config/] [powerpc/] [sjlj.S] - Blame information for rev 848

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 737 jeremybenn
/* Copyright (C) 2012 Free Software Foundation, Inc.
2
   Contributed by Richard Henderson .
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
   .  */
24
 
25
        .text
26
 
27
#include "asmcfi.h"
28
 
29
#if defined(__powerpc64__) && defined(__ELF__)
30
.macro FUNC name
31
        .globl  \name, .\name
32
        .section ".opd","aw"
33
        .align  3
34
\name:
35
        .quad   .\name, .TOC.@tocbase, 0
36
        .size   \name, 24
37
        .type   .\name, @function
38
        .text
39
.\name:
40
.endm
41
.macro END name
42
        .size   .\name, . - .\name
43
.endm
44
.macro HIDDEN name
45
        .hidden \name, .\name
46
.endm
47
.macro CALL name
48
        bl      \name
49
        nop
50
.endm
51
#elif defined(__ELF__)
52
.macro FUNC name
53
        .globl  \name
54
        .type   \name, @function
55
\name:
56
.endm
57
.macro END name
58
        .size   \name, . - \name
59
.endm
60
.macro HIDDEN name
61
        .hidden \name
62
.endm
63
.macro CALL name
64
        bl      \name
65
.endm
66
#elif defined(_CALL_DARWIN)
67
.macro FUNC name
68
        .globl  _$0
69
_$0:
70
.endmacro
71
.macro END name
72
.endmacro
73
.macro HIDDEN name
74
        .private_extern _$0
75
.endmacro
76
.macro CALL name
77
        bl      _$0
78
.endmacro
79
# ifdef __ppc64__
80
        .machine ppc64
81
# else
82
        .machine ppc7400
83
# endif
84
#else
85
#error "unsupported system"
86
#endif
87
 
88
/* Parameterize the naming of registers.  */
89
#if defined(__ELF__)
90
# define r(N)   %r##N
91
# define f(N)   %f##N
92
# define v(N)   %v##N
93
#elif defined(__MACH__)
94
# define r(N)   r##N
95
# define f(N)   f##N
96
# define v(N)   v##N
97
#else
98
# define r(N)   N
99
# define f(N)   N
100
# define v(N)   N
101
#endif
102
 
103
/* Parameterize the code for 32-bit vs 64-bit.  */
104
#if defined(__powerpc64__) || defined(__ppc64__)
105
#define ldreg   ld
106
#define streg   std
107
#define stregu  stdu
108
#define WS      8
109
#else
110
#define ldreg   lwz
111
#define streg   stw
112
#define stregu  stwu
113
#define WS      4
114
#endif
115
 
116
/* Parameterize the code for call frame constants.  */
117
#if defined(_CALL_AIXDESC)
118
# define BASE           6*WS
119
# define LR_SAVE        2*WS
120
#elif defined(_CALL_SYSV)
121
# define BASE           2*WS
122
# define LR_SAVE        1*WS
123
#elif defined(_CALL_DARWIN)
124
# define BASE           (6*WS + 2*WS)
125
# define LR_SAVE        2*WS
126
#else
127
# error "unsupported system"
128
#endif
129
 
130
#if defined(__ALTIVEC__) || defined(__VSX__)
131
# define OFS_VR         0
132
# define OFS_VSCR       12*16
133
# define OFS_VR_END     OFS_VSCR + 8
134
#else
135
# define OFS_VR_END     0
136
#endif
137
#ifndef _SOFT_FLOAT
138
# define OFS_FR         OFS_VR_END
139
# define OFS_FPSCR      OFS_FR + 18*8
140
# define OFS_FR_END     OFS_FPSCR + 8
141
#else
142
# define OFS_FR_END     OFS_VR_END
143
#endif
144
#define OFS_GR          OFS_FR_END
145
#define OFS_CFA         OFS_GR + 18*WS
146
#define OFS_LR          OFS_CFA + WS
147
#define OFS_TOC         OFS_LR + WS
148
#define OFS_CR          OFS_TOC + WS
149
#define OFS_END         (((OFS_CR + WS + 15) / 16) * 16)
150
 
151
#define FRAME           (((BASE + OFS_END + 15) / 16) * 16)
152
#define VRSAVE          256
153
 
154
        .align  4
155
FUNC _ITM_beginTransaction
156
        cfi_startproc
157
        mflr    r(0)
158
        mfcr    r(5)
159
        addi    r(4), r(1), -OFS_END
160
        mr      r(6), r(1)
161
        streg   r(0), LR_SAVE(r(1))
162
        stregu  r(1), -FRAME(r(1))
163
        cfi_def_cfa_offset(FRAME)
164
        cfi_offset(65, LR_SAVE)
165
        streg   r(6),  OFS_CFA(r(4))
166
        streg   r(0),   OFS_LR(r(4))
167
#ifdef _CALL_DARWIN
168
        streg   r(13),  OFS_TOC(r(4))
169
#else
170
        streg   r(2),   OFS_TOC(r(4))
171
#endif
172
        streg   r(5),   OFS_CR(r(4))
173
        streg   r(14),  0*WS+OFS_GR(r(4))
174
        streg   r(15),  1*WS+OFS_GR(r(4))
175
        streg   r(16),  2*WS+OFS_GR(r(4))
176
        streg   r(17),  3*WS+OFS_GR(r(4))
177
        streg   r(18),  4*WS+OFS_GR(r(4))
178
        streg   r(19),  5*WS+OFS_GR(r(4))
179
        streg   r(20),  6*WS+OFS_GR(r(4))
180
        streg   r(21),  7*WS+OFS_GR(r(4))
181
        streg   r(22),  8*WS+OFS_GR(r(4))
182
        streg   r(23),  9*WS+OFS_GR(r(4))
183
        streg   r(24), 10*WS+OFS_GR(r(4))
184
        streg   r(25), 11*WS+OFS_GR(r(4))
185
        streg   r(26), 12*WS+OFS_GR(r(4))
186
        streg   r(27), 13*WS+OFS_GR(r(4))
187
        streg   r(28), 14*WS+OFS_GR(r(4))
188
        streg   r(29), 15*WS+OFS_GR(r(4))
189
        streg   r(30), 16*WS+OFS_GR(r(4))
190
        streg   r(31), 17*WS+OFS_GR(r(4))
191
 
192
#ifndef _SOFT_FLOAT
193
        /* ??? Determine when FPRs not present.  */
194
        /* ??? Test r(3) for pr_hasNoFloatUpdate and skip the fp save.
195
           This is not yet set by the compiler.  */
196
        mffs    f(0)
197
        stfd    f(14),  0+OFS_FR(r(4))
198
        stfd    f(15),  8+OFS_FR(r(4))
199
        stfd    f(16), 16+OFS_FR(r(4))
200
        stfd    f(17), 24+OFS_FR(r(4))
201
        stfd    f(18), 32+OFS_FR(r(4))
202
        stfd    f(19), 40+OFS_FR(r(4))
203
        stfd    f(20), 48+OFS_FR(r(4))
204
        stfd    f(21), 56+OFS_FR(r(4))
205
        stfd    f(22), 64+OFS_FR(r(4))
206
        stfd    f(23), 72+OFS_FR(r(4))
207
        stfd    f(24), 80+OFS_FR(r(4))
208
        stfd    f(25), 88+OFS_FR(r(4))
209
        stfd    f(26), 96+OFS_FR(r(4))
210
        stfd    f(27),104+OFS_FR(r(4))
211
        stfd    f(28),112+OFS_FR(r(4))
212
        stfd    f(29),120+OFS_FR(r(4))
213
        stfd    f(30),128+OFS_FR(r(4))
214
        stfd    f(31),136+OFS_FR(r(4))
215
        stfd    f(0), OFS_FPSCR(r(4))
216
#endif
217
 
218
#if defined(__ALTIVEC__)
219
        /* ??? Determine when VRs not present.  */
220
        /* ??? Test r(3) for pr_hasNoVectorUpdate and skip the vr save.
221
           This is not yet set by the compiler.  */
222
        addi    r(5), r(4), OFS_VR
223
        addi    r(6), r(4), OFS_VR+16
224
        mfspr   r(0), VRSAVE
225
        stvx    v(20), 0, r(5)
226
        addi    r(5), r(5), 32
227
        stvx    v(21), 0, r(6)
228
        addi    r(6), r(6), 32
229
        stvx    v(22), 0, r(5)
230
        addi    r(5), r(5), 32
231
        stvx    v(23), 0, r(6)
232
        addi    r(6), r(6), 32
233
        stvx    v(25), 0, r(5)
234
        addi    r(5), r(5), 32
235
        stvx    v(26), 0, r(6)
236
        addi    r(6), r(6), 32
237
        stvx    v(26), 0, r(5)
238
        addi    r(5), r(5), 32
239
        stvx    v(27), 0, r(6)
240
        addi    r(6), r(6), 32
241
        stvx    v(28), 0, r(5)
242
        addi    r(5), r(5), 32
243
        stvx    v(29), 0, r(6)
244
        addi    r(6), r(6), 32
245
        stvx    v(30), 0, r(5)
246
        stvx    v(31), 0, r(6)
247
        streg   r(0), OFS_VSCR(r(4))
248
#endif
249
 
250
        CALL    GTM_begin_transaction
251
 
252
        ldreg   r(0), LR_SAVE+FRAME(r(1))
253
        mtlr    r(0)
254
        addi    r(1), r(1), FRAME
255
        cfi_def_cfa_offset(0)
256
        cfi_restore(65)
257
        blr
258
        cfi_endproc
259
END _ITM_beginTransaction
260
 
261
        .align 4
262
        HIDDEN  GTM_longjmp
263
FUNC GTM_longjmp
264
        cfi_startproc
265
#if defined(__ALTIVEC__) || defined(__VSX__)
266
        /* ??? Determine when VRs not present.  */
267
        /* ??? Test r(5) for pr_hasNoVectorUpdate and skip the vr restore.
268
           This is not yet set by the compiler.  */
269
        addi    r(6), r(4), OFS_VR
270
        addi    r(7), r(4), OFS_VR+16
271
        ldreg   r(0), OFS_VSCR(r(4))
272
        cfi_undefined(v(20))
273
        cfi_undefined(v(21))
274
        cfi_undefined(v(22))
275
        cfi_undefined(v(23))
276
        cfi_undefined(v(24))
277
        cfi_undefined(v(25))
278
        cfi_undefined(v(26))
279
        cfi_undefined(v(27))
280
        cfi_undefined(v(28))
281
        cfi_undefined(v(29))
282
        cfi_undefined(v(30))
283
        cfi_undefined(v(31))
284
        lvx     v(20), 0, r(6)
285
        addi    r(6), r(6), 32
286
        lvx     v(21), 0, r(7)
287
        addi    r(7), r(7), 32
288
        lvx     v(22), 0, r(6)
289
        addi    r(6), r(6), 32
290
        lvx     v(23), 0, r(7)
291
        addi    r(7), r(7), 32
292
        lvx     v(24), 0, r(6)
293
        addi    r(6), r(6), 32
294
        lvx     v(25), 0, r(7)
295
        addi    r(7), r(7), 32
296
        lvx     v(26), 0, r(6)
297
        addi    r(6), r(6), 32
298
        lvx     v(27), 0, r(7)
299
        addi    r(7), r(7), 32
300
        lvx     v(28), 0, r(6)
301
        addi    r(6), r(6), 32
302
        lvx     v(29), 0, r(7)
303
        addi    r(7), r(7), 32
304
        lvx     v(30), 0, r(6)
305
        lvx     v(31), 0, r(7)
306
        mtspr   VRSAVE, r(0)
307
#endif
308
 
309
#ifndef _SOFT_FLOAT
310
        /* ??? Determine when FPRs not present.  */
311
        /* ??? Test r(5) for pr_hasNoFloatUpdate and skip the fp load.
312
           This is not yet set by the compiler.  */
313
        lfd     f(0), OFS_FPSCR(r(4))
314
        cfi_undefined(f(14))
315
        cfi_undefined(f(15))
316
        cfi_undefined(f(16))
317
        cfi_undefined(f(17))
318
        cfi_undefined(f(18))
319
        cfi_undefined(f(19))
320
        cfi_undefined(f(20))
321
        cfi_undefined(f(21))
322
        cfi_undefined(f(22))
323
        cfi_undefined(f(23))
324
        cfi_undefined(f(24))
325
        cfi_undefined(f(25))
326
        cfi_undefined(f(26))
327
        cfi_undefined(f(27))
328
        cfi_undefined(f(28))
329
        cfi_undefined(f(29))
330
        cfi_undefined(f(30))
331
        cfi_undefined(f(31))
332
        lfd     f(14),  0+OFS_FR(r(4))
333
        lfd     f(15),  8+OFS_FR(r(4))
334
        lfd     f(16), 16+OFS_FR(r(4))
335
        lfd     f(17), 24+OFS_FR(r(4))
336
        lfd     f(18), 32+OFS_FR(r(4))
337
        lfd     f(19), 40+OFS_FR(r(4))
338
        lfd     f(20), 48+OFS_FR(r(4))
339
        lfd     f(21), 56+OFS_FR(r(4))
340
        lfd     f(22), 64+OFS_FR(r(4))
341
        lfd     f(23), 72+OFS_FR(r(4))
342
        lfd     f(24), 80+OFS_FR(r(4))
343
        lfd     f(25), 88+OFS_FR(r(4))
344
        lfd     f(26), 96+OFS_FR(r(4))
345
        lfd     f(27),104+OFS_FR(r(4))
346
        lfd     f(28),112+OFS_FR(r(4))
347
        lfd     f(29),120+OFS_FR(r(4))
348
        lfd     f(30),128+OFS_FR(r(4))
349
        lfd     f(31),136+OFS_FR(r(4))
350
        mtfsf   0xff, f(0)
351
#endif
352
 
353
        ldreg   r(6),   OFS_CFA(r(4))
354
        ldreg   r(0),   OFS_LR(r(4))
355
#ifdef _CALL_DARWIN
356
        ldreg   r(13),  OFS_TOC(r(4))
357
#else
358
        ldreg   r(2),   OFS_TOC(r(4))
359
#endif
360
        ldreg   r(7),   OFS_CR(r(4))
361
        /* At the instant we restore the LR, the only coherent view of
362
           the world we have is into the new stack frame.  Define the
363
           CFA in terms of the not-yet-restored stack pointer.  This will
364
           last until the end of the function.  */
365
        mtlr    r(0)
366
        cfi_def_cfa(r(6), 0)
367
        cfi_undefined(r(14))
368
        cfi_undefined(r(15))
369
        cfi_undefined(r(16))
370
        cfi_undefined(r(17))
371
        cfi_undefined(r(18))
372
        cfi_undefined(r(19))
373
        cfi_undefined(r(20))
374
        cfi_undefined(r(21))
375
        cfi_undefined(r(22))
376
        cfi_undefined(r(23))
377
        cfi_undefined(r(24))
378
        cfi_undefined(r(25))
379
        cfi_undefined(r(26))
380
        cfi_undefined(r(27))
381
        cfi_undefined(r(28))
382
        cfi_undefined(r(29))
383
        cfi_undefined(r(30))
384
        cfi_undefined(r(31))
385
        mtcr    r(7)
386
        ldreg   r(14),  0*WS+OFS_GR(r(4))
387
        ldreg   r(15),  1*WS+OFS_GR(r(4))
388
        ldreg   r(16),  2*WS+OFS_GR(r(4))
389
        ldreg   r(17),  3*WS+OFS_GR(r(4))
390
        ldreg   r(18),  4*WS+OFS_GR(r(4))
391
        ldreg   r(19),  5*WS+OFS_GR(r(4))
392
        ldreg   r(20),  6*WS+OFS_GR(r(4))
393
        ldreg   r(21),  7*WS+OFS_GR(r(4))
394
        ldreg   r(22),  8*WS+OFS_GR(r(4))
395
        ldreg   r(23),  9*WS+OFS_GR(r(4))
396
        ldreg   r(24), 10*WS+OFS_GR(r(4))
397
        ldreg   r(25), 11*WS+OFS_GR(r(4))
398
        ldreg   r(26), 12*WS+OFS_GR(r(4))
399
        ldreg   r(27), 13*WS+OFS_GR(r(4))
400
        ldreg   r(28), 14*WS+OFS_GR(r(4))
401
        ldreg   r(29), 15*WS+OFS_GR(r(4))
402
        ldreg   r(30), 16*WS+OFS_GR(r(4))
403
        ldreg   r(31), 17*WS+OFS_GR(r(4))
404
        mr      r(1), r(6)
405
        blr
406
        cfi_endproc
407
END GTM_longjmp
408
 
409
#ifdef __linux__
410
.section .note.GNU-stack, "", @progbits
411
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.