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 .pushsection .text,"ax",@progbits 20 __ALIGN 21 #else 22 .pushsection .text.\name,"axG",@progbits,\name,comdat 23 #endif 24 .globl \name 25 .hidden \name 26 .type \name,@function 27 \name: 28 CFI_STARTPROC 29 .endm 30 31 .macro __THUNK_EPILOG_NAME name 32 CFI_ENDPROC 33 #ifdef CONFIG_EXPOLINE_EXTERN 34 .size \name, .-\name 35 #endif 36 .popsection 37 .endm 38 39 .macro __THUNK_PROLOG_BR r1 40 __THUNK_PROLOG_NAME __s390_indirect_jump_r\r1 41 .endm 42 43 .macro __THUNK_EPILOG_BR r1 44 __THUNK_EPILOG_NAME __s390_indirect_jump_r\r1 45 .endm 46 47 .macro __THUNK_BR r1 48 jg __s390_indirect_jump_r\r1 49 .endm 50 51 .macro __THUNK_BRASL r1,r2 52 brasl \r1,__s390_indirect_jump_r\r2 53 .endm 54 55 .macro __DECODE_R expand,reg 56 .set .L__decode_fail,1 57 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 58 .ifc \reg,%r\r1 59 \expand \r1 60 .set .L__decode_fail,0 61 .endif 62 .endr 63 .if .L__decode_fail == 1 64 .error "__DECODE_R failed" 65 .endif 66 .endm 67 68 .macro __DECODE_RR expand,rsave,rtarget 69 .set .L__decode_fail,1 70 .irp r1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 71 .ifc \rsave,%r\r1 72 .irp r2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 73 .ifc \rtarget,%r\r2 74 \expand \r1,\r2 75 .set .L__decode_fail,0 76 .endif 77 .endr 78 .endif 79 .endr 80 .if .L__decode_fail == 1 81 .error "__DECODE_RR failed" 82 .endif 83 .endm 84 85 .macro __THUNK_EX_BR reg 86 exrl 0,555f 87 j . 88 555: br \reg 89 .endm 90 91 #ifdef CONFIG_EXPOLINE_EXTERN 92 .macro GEN_BR_THUNK reg 93 .endm 94 .macro GEN_BR_THUNK_EXTERN reg 95 #else 96 .macro GEN_BR_THUNK reg 97 #endif 98 __DECODE_R __THUNK_PROLOG_BR,\reg 99 __THUNK_EX_BR \reg 100 __DECODE_R __THUNK_EPILOG_BR,\reg 101 .endm 102 103 .macro BR_EX reg 104 557: __DECODE_R __THUNK_BR,\reg 105 .pushsection .s390_indirect_branches,"a",@progbits 106 .long 557b-. 107 .popsection 108 .endm 109 110 .macro BASR_EX rsave,rtarget 111 559: __DECODE_RR __THUNK_BRASL,\rsave,\rtarget 112 .pushsection .s390_indirect_branches,"a",@progbits 113 .long 559b-. 114 .popsection 115 .endm 116 117 #else 118 .macro GEN_BR_THUNK reg 119 .endm 120 121 .macro BR_EX reg 122 br \reg 123 .endm 124 125 .macro BASR_EX rsave,rtarget 126 basr \rsave,\rtarget 127 .endm 128 #endif /* CC_USING_EXPOLINE */ 129 130 #endif /* __ASSEMBLY__ */ 131 132 #endif /* _ASM_S390_NOSPEC_ASM_H */ 133