1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_S390_NOSPEC_ASM_H 3 #define _ASM_S390_NOSPEC_ASM_H 4 5 #include <linux/linkage.h> 6 #include <asm/dwarf.h> 7 8 #ifdef __ASSEMBLY__ 9 10 #ifdef CC_USING_EXPOLINE 11 12 /* 13 * The expoline macros are used to create thunks in the same format 14 * as gcc generates them. The 'comdat' section flag makes sure that 15 * the various thunks are merged into a single copy. 16 */ 17 .macro __THUNK_PROLOG_NAME name 18 #ifdef CONFIG_EXPOLINE_EXTERN 19 SYM_CODE_START(\name) 20 #else 21 .pushsection .text.\name,"axG",@progbits,\name,comdat 22 .globl \name 23 .hidden \name 24 .type \name,@function 25 \name: 26 CFI_STARTPROC 27 #endif 28 .endm 29 30 .macro __THUNK_EPILOG_NAME name 31 #ifdef CONFIG_EXPOLINE_EXTERN 32 SYM_CODE_END(\name) 33 EXPORT_SYMBOL(\name) 34 #else 35 CFI_ENDPROC 36 .popsection 37 #endif 38 .endm 39 40 .macro __THUNK_PROLOG_BR r1 41 __THUNK_PROLOG_NAME __s390_indirect_jump_r\r1 42 .endm 43 44 .macro __THUNK_EPILOG_BR r1 45 __THUNK_EPILOG_NAME __s390_indirect_jump_r\r1 46 .endm 47 48 .macro __THUNK_BR r1 49 jg __s390_indirect_jump_r\r1 50 .endm 51 52 .macro __THUNK_BRASL r1,r2 53 brasl \r1,__s390_indirect_jump_r\r2 54 .endm 55 56 .macro __DECODE_R expand,reg 57 .set .L__decode_fail,1 58 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 59 .ifc \reg,%r\r1 60 \expand \r1 61 .set .L__decode_fail,0 62 .endif 63 .endr 64 .if .L__decode_fail == 1 65 .error "__DECODE_R failed" 66 .endif 67 .endm 68 69 .macro __DECODE_RR expand,rsave,rtarget 70 .set .L__decode_fail,1 71 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 72 .ifc \rsave,%r\r1 73 .irp r2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 74 .ifc \rtarget,%r\r2 75 \expand \r1,\r2 76 .set .L__decode_fail,0 77 .endif 78 .endr 79 .endif 80 .endr 81 .if .L__decode_fail == 1 82 .error "__DECODE_RR failed" 83 .endif 84 .endm 85 86 .macro __THUNK_EX_BR reg 87 exrl 0,555f 88 j . 89 555: br \reg 90 .endm 91 92 #ifdef CONFIG_EXPOLINE_EXTERN 93 .macro GEN_BR_THUNK reg 94 .endm 95 .macro GEN_BR_THUNK_EXTERN reg 96 #else 97 .macro GEN_BR_THUNK reg 98 #endif 99 __DECODE_R __THUNK_PROLOG_BR,\reg 100 __THUNK_EX_BR \reg 101 __DECODE_R __THUNK_EPILOG_BR,\reg 102 .endm 103 104 .macro BR_EX reg 105 557: __DECODE_R __THUNK_BR,\reg 106 .pushsection .s390_indirect_branches,"a",@progbits 107 .long 557b-. 108 .popsection 109 .endm 110 111 .macro BASR_EX rsave,rtarget 112 559: __DECODE_RR __THUNK_BRASL,\rsave,\rtarget 113 .pushsection .s390_indirect_branches,"a",@progbits 114 .long 559b-. 115 .popsection 116 .endm 117 118 #else 119 .macro GEN_BR_THUNK reg 120 .endm 121 122 .macro BR_EX reg 123 br \reg 124 .endm 125 126 .macro BASR_EX rsave,rtarget 127 basr \rsave,\rtarget 128 .endm 129 #endif /* CC_USING_EXPOLINE */ 130 131 #endif /* __ASSEMBLY__ */ 132 133 #endif /* _ASM_S390_NOSPEC_ASM_H */ 134