1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 2 /* 3 * Copyright (C) 2020 Emil Renner Berthing 4 * 5 * Based on arch/arm64/include/asm/jump_label. 6 */ 7 #ifndef __ASM_JUMP_LABEL_H 8 #define __ASM_JUMP_LABEL_H 9 10 #ifndef __ASSEMBLY__ 11 12 #include <linux/types.h> 13 #include <asm/asm.h> 14 15 #define HAVE_JUMP_LABEL_BATCH 16 17 #define JUMP_LABEL_NOP_SIZE 4 18 19 static __always_inline bool arch_static_branch 20 21 { 22 asm goto( 23 " .align 2 24 " .option push 25 " .option norelax 26 " .option norvc 27 "1: nop 28 " .option pop 29 " .pushsection __jump 30 " .align " RISC 31 " .long 1b - . 32 " " RISCV_PTR " %0 - . 33 " .popsection 34 : : "i"(&((char *)key)[branc 35 36 return false; 37 label: 38 return true; 39 } 40 41 static __always_inline bool arch_static_branch 42 43 { 44 asm goto( 45 " .align 2 46 " .option push 47 " .option norelax 48 " .option norvc 49 "1: j %l[lab 50 " .option pop 51 " .pushsection __jump 52 " .align " RISC 53 " .long 1b - . 54 " " RISCV_PTR " %0 - . 55 " .popsection 56 : : "i"(&((char *)key)[branc 57 58 return false; 59 label: 60 return true; 61 } 62 63 #endif /* __ASSEMBLY__ */ 64 #endif /* __ASM_JUMP_LABEL_H */ 65
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.