1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_NOSPEC_ASM_H
3 #define _ASM_S390_NOSPEC_ASM_H
5 #include <asm/alternative-asm.h>
6 #include <asm/asm-offsets.h>
11 #ifdef CC_USING_EXPOLINE
13 _LC_BR_R1 = __LC_BR_R1
16 * The expoline macros are used to create thunks in the same format
17 * as gcc generates them. The 'comdat' section flag makes sure that
18 * the various thunks are merged into a single copy.
20 .macro __THUNK_PROLOG_NAME name
21 .pushsection .text.\name,"axG",@progbits,\name,comdat
34 .macro __THUNK_PROLOG_BR r1,r2
35 __THUNK_PROLOG_NAME __s390_indirect_jump_r\r2\()use_r\r1
38 .macro __THUNK_PROLOG_BC d0,r1,r2
39 __THUNK_PROLOG_NAME __s390_indirect_branch_\d0\()_\r2\()use_\r1
42 .macro __THUNK_BR r1,r2
43 jg __s390_indirect_jump_r\r2\()use_r\r1
46 .macro __THUNK_BC d0,r1,r2
47 jg __s390_indirect_branch_\d0\()_\r2\()use_\r1
50 .macro __THUNK_BRASL r1,r2,r3
51 brasl \r1,__s390_indirect_jump_r\r3\()use_r\r2
54 .macro __DECODE_RR expand,reg,ruse
56 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
58 .irp r2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
66 .if __decode_fail == 1
67 .error "__DECODE_RR failed"
71 .macro __DECODE_RRR expand,rsave,rtarget,ruse
73 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
75 .irp r2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
77 .irp r3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
87 .if __decode_fail == 1
88 .error "__DECODE_RRR failed"
92 .macro __DECODE_DRR expand,disp,reg,ruse
94 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
96 .irp r2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
104 .if __decode_fail == 1
105 .error "__DECODE_DRR failed"
109 .macro __THUNK_EX_BR reg,ruse
110 # Be very careful when adding instructions to this macro!
111 # The ALTERNATIVE replacement code has a .+10 which targets
112 # the "br \reg" after the code has been patched.
113 #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
118 ALTERNATIVE "ex %r0,_LC_BR_R1", ".insn ril,0xc60000000000,0,.+10", 35
129 .macro __THUNK_EX_BC disp,reg,ruse
130 #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
141 .macro GEN_BR_THUNK reg,ruse=%r1
142 __DECODE_RR __THUNK_PROLOG_BR,\reg,\ruse
143 __THUNK_EX_BR \reg,\ruse
147 .macro GEN_B_THUNK disp,reg,ruse=%r1
148 __DECODE_DRR __THUNK_PROLOG_BC,\disp,\reg,\ruse
149 __THUNK_EX_BC \disp,\reg,\ruse
153 .macro BR_EX reg,ruse=%r1
154 557: __DECODE_RR __THUNK_BR,\reg,\ruse
155 .pushsection .s390_indirect_branches,"a",@progbits
160 .macro B_EX disp,reg,ruse=%r1
161 558: __DECODE_DRR __THUNK_BC,\disp,\reg,\ruse
162 .pushsection .s390_indirect_branches,"a",@progbits
167 .macro BASR_EX rsave,rtarget,ruse=%r1
168 559: __DECODE_RRR __THUNK_BRASL,\rsave,\rtarget,\ruse
169 .pushsection .s390_indirect_branches,"a",@progbits
175 .macro GEN_BR_THUNK reg,ruse=%r1
178 .macro GEN_B_THUNK disp,reg,ruse=%r1
181 .macro BR_EX reg,ruse=%r1
185 .macro B_EX disp,reg,ruse=%r1
189 .macro BASR_EX rsave,rtarget,ruse=%r1
192 #endif /* CC_USING_EXPOLINE */
194 #endif /* __ASSEMBLY__ */
196 #endif /* _ASM_S390_NOSPEC_ASM_H */