| 1 |
/* Copyright (C) 2013-2025 Free Software Foundation, Inc. |
| 2 |
Contributed by Andreas Krebbel <[email protected]> |
| 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 |
|
| 25 |
|
| 26 |
#include "asmcfi.h" |
| 27 |
|
| 28 |
.text |
| 29 |
.align 4 |
| 30 |
.globl _ITM_beginTransaction |
| 31 |
.type _ITM_beginTransaction, @function |
| 32 |
|
| 33 |
/* _ITM_beginTransaction (int props); props -> r2 */ |
| 34 |
_ITM_beginTransaction: |
| 35 |
cfi_startproc |
| 36 |
#ifdef __s390x__ |
| 37 |
lgr %r3,%r15 /* backup stack pointer */ |
| 38 |
aghi %r15,-304 /* jump buffer (144) + reg save area (160) */ |
| 39 |
cfi_adjust_cfa_offset(304) |
| 40 |
stmg %r6,%r14,160(%r15) |
| 41 |
stg %r3,72+160(%r15) /* store the old stack pointer */ |
| 42 |
std %f8,80+160(%r15) |
| 43 |
std %f9,88+160(%r15) |
| 44 |
std %f10,96+160(%r15) |
| 45 |
std %f11,104+160(%r15) |
| 46 |
std %f12,112+160(%r15) |
| 47 |
std %f13,120+160(%r15) |
| 48 |
std %f14,128+160(%r15) |
| 49 |
std %f15,136+160(%r15) |
| 50 |
la %r3,160(%r15) /* second argument to GTM_begin_transaction */ |
| 51 |
brasl %r14,GTM_begin_transaction |
| 52 |
lg %r1,64+160(%r15) |
| 53 |
aghi %r15,304 |
| 54 |
cfi_adjust_cfa_offset(-304) |
| 55 |
br %r1 |
| 56 |
#else |
| 57 |
lr %r3,%r15 /* backup stack pointer */ |
| 58 |
ahi %r15,-152 /* jump buffer (56) + reg save area (96) */ |
| 59 |
cfi_adjust_cfa_offset(152) |
| 60 |
stm %r6,%r14,96(%r15) |
| 61 |
st %r3,36+96(%r15) /* store the old stack pointer */ |
| 62 |
std %f4,40+96(%r15) |
| 63 |
std %f6,48+96(%r15) |
| 64 |
la %r3,96(%r15) /* second argument to GTM_begin_transaction */ |
| 65 |
/* begin_transaction (uint32_t prop, const gtm_jmpbuf *jb) */ |
| 66 |
brasl %r14,GTM_begin_transaction /* requires mzarch */ |
| 67 |
l %r1,32+96(%r15) |
| 68 |
ahi %r15,152 |
| 69 |
cfi_adjust_cfa_offset(-152) |
| 70 |
br %r1 |
| 71 |
#endif |
| 72 |
cfi_endproc |
| 73 |
|
| 74 |
.size _ITM_beginTransaction, .-_ITM_beginTransaction |
| 75 |
|
| 76 |
.align 4 |
| 77 |
.globl GTM_longjmp |
| 78 |
.type GTM_longjmp, @function |
| 79 |
.hidden GTM_longjmp |
| 80 |
|
| 81 |
/* uint32_t GTM_longjmp (uint32_t, const gtm_jmpbuf *, uint32_t) */ |
| 82 |
GTM_longjmp: |
| 83 |
/* First parameter becomes the return value of |
| 84 |
_ITM_beginTransaction (r2). |
| 85 |
Third parameter is ignored for now. */ |
| 86 |
cfi_startproc |
| 87 |
#ifdef __s390x__ |
| 88 |
ld %f8,80(%r3) |
| 89 |
ld %f9,88(%r3) |
| 90 |
ld %f10,96(%r3) |
| 91 |
ld %f11,104(%r3) |
| 92 |
ld %f12,112(%r3) |
| 93 |
ld %f13,120(%r3) |
| 94 |
ld %f14,128(%r3) |
| 95 |
ld %f15,136(%r3) |
| 96 |
lmg %r6,%r15,0(%r3) |
| 97 |
br %r14 |
| 98 |
#else |
| 99 |
ld %f4,40(%r3) |
| 100 |
ld %f6,48(%r3) |
| 101 |
lm %r6,%r15,0(%r3) |
| 102 |
br %r14 |
| 103 |
#endif |
| 104 |
cfi_endproc |
| 105 |
|
| 106 |
.size GTM_longjmp, .-GTM_longjmp |
| 107 |
|
| 108 |
.section .note.GNU-stack, "", @progbits |