1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_S390_JUMP_LABEL_H 3 #define _ASM_S390_JUMP_LABEL_H 4 5 #ifndef __ASSEMBLY__ 6 7 #include <linux/types.h> 8 #include <linux/stringify.h> 9 10 #define JUMP_LABEL_NOP_SIZE 6 11 #define JUMP_LABEL_NOP_OFFSET 2 12 13 /* 14 * We use a brcl 0,2 instruction for jump labels at compile time so it 15 * can be easily distinguished from a hotpatch generated instruction. 16 */ 17 static inline bool arch_static_branch(struct static_key *key, bool branch) 18 { 19 asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n" 20 ".pushsection __jump_table,\"aw\"\n" 21 ".balign 8\n" 22 ".long 0b-.,%l[label]-.\n" 23 ".quad %0-.\n" 24 ".popsection\n" 25 : : "X" (&((char *)key)[branch]) : : label); 26 return false; 27 label: 28 return true; 29 } 30 31 static inline bool arch_static_branch_jump(struct static_key *key, bool branch) 32 { 33 asm_volatile_goto("0: brcl 15,%l[label]\n" 34 ".pushsection __jump_table,\"aw\"\n" 35 ".balign 8\n" 36 ".long 0b-.,%l[label]-.\n" 37 ".quad %0-.\n" 38 ".popsection\n" 39 : : "X" (&((char *)key)[branch]) : : label); 40 return false; 41 label: 42 return true; 43 } 44 45 #endif /* __ASSEMBLY__ */ 46 #endif 47