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