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>
10 #ifdef CONFIG_EXPOLINE
12 _LC_BR_R1 = __LC_BR_R1
15 * The expoline macros are used to create thunks in the same format
16 * as gcc generates them. The 'comdat' section flag makes sure that
17 * the various thunks are merged into a single copy.
19 .macro __THUNK_PROLOG_NAME name
20 .pushsection .text.\name,"axG",@progbits,\name,comdat
33 .macro __THUNK_PROLOG_BR r1,r2
34 __THUNK_PROLOG_NAME __s390x_indirect_jump_r\r2\()use_r\r1
37 .macro __THUNK_PROLOG_BC d0,r1,r2
38 __THUNK_PROLOG_NAME __s390x_indirect_branch_\d0\()_\r2\()use_\r1
41 .macro __THUNK_BR r1,r2
42 jg __s390x_indirect_jump_r\r2\()use_r\r1
45 .macro __THUNK_BC d0,r1,r2
46 jg __s390x_indirect_branch_\d0\()_\r2\()use_\r1
49 .macro __THUNK_BRASL r1,r2,r3
50 brasl \r1,__s390x_indirect_jump_r\r3\()use_r\r2
53 .macro __DECODE_RR expand,reg,ruse
55 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
57 .irp r2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
65 .if __decode_fail == 1
66 .error "__DECODE_RR failed"
70 .macro __DECODE_RRR expand,rsave,rtarget,ruse
72 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
74 .irp r2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
76 .irp r3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
86 .if __decode_fail == 1
87 .error "__DECODE_RRR failed"
91 .macro __DECODE_DRR expand,disp,reg,ruse
93 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
95 .irp r2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
103 .if __decode_fail == 1
104 .error "__DECODE_DRR failed"
108 .macro __THUNK_EX_BR reg,ruse
109 # Be very careful when adding instructions to this macro!
110 # The ALTERNATIVE replacement code has a .+10 which targets
111 # the "br \reg" after the code has been patched.
112 #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
117 ALTERNATIVE "ex %r0,_LC_BR_R1", ".insn ril,0xc60000000000,0,.+10", 35
128 .macro __THUNK_EX_BC disp,reg,ruse
129 #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
140 .macro GEN_BR_THUNK reg,ruse=%r1
141 __DECODE_RR __THUNK_PROLOG_BR,\reg,\ruse
142 __THUNK_EX_BR \reg,\ruse
146 .macro GEN_B_THUNK disp,reg,ruse=%r1
147 __DECODE_DRR __THUNK_PROLOG_BC,\disp,\reg,\ruse
148 __THUNK_EX_BC \disp,\reg,\ruse
152 .macro BR_EX reg,ruse=%r1
153 557: __DECODE_RR __THUNK_BR,\reg,\ruse
154 .pushsection .s390_indirect_branches,"a",@progbits
159 .macro B_EX disp,reg,ruse=%r1
160 558: __DECODE_DRR __THUNK_BC,\disp,\reg,\ruse
161 .pushsection .s390_indirect_branches,"a",@progbits
166 .macro BASR_EX rsave,rtarget,ruse=%r1
167 559: __DECODE_RRR __THUNK_BRASL,\rsave,\rtarget,\ruse
168 .pushsection .s390_indirect_branches,"a",@progbits
174 .macro GEN_BR_THUNK reg,ruse=%r1
177 .macro GEN_B_THUNK disp,reg,ruse=%r1
180 .macro BR_EX reg,ruse=%r1
184 .macro B_EX disp,reg,ruse=%r1
188 .macro BASR_EX rsave,rtarget,ruse=%r1
193 #endif /* __ASSEMBLY__ */
195 #endif /* _ASM_S390_NOSPEC_ASM_H */