0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __ASM_JUMP_LABEL_H
0009 #define __ASM_JUMP_LABEL_H
0010
0011 #ifndef __ASSEMBLY__
0012
0013 #include <linux/types.h>
0014 #include <asm/insn.h>
0015
0016 #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
0017
0018 static __always_inline bool arch_static_branch(struct static_key *key,
0019 bool branch)
0020 {
0021 asm_volatile_goto(
0022 "1: nop \n\t"
0023 " .pushsection __jump_table, \"aw\" \n\t"
0024 " .align 3 \n\t"
0025 " .long 1b - ., %l[l_yes] - . \n\t"
0026 " .quad %c0 - . \n\t"
0027 " .popsection \n\t"
0028 : : "i"(&((char *)key)[branch]) : : l_yes);
0029
0030 return false;
0031 l_yes:
0032 return true;
0033 }
0034
0035 static __always_inline bool arch_static_branch_jump(struct static_key *key,
0036 bool branch)
0037 {
0038 asm_volatile_goto(
0039 "1: b %l[l_yes] \n\t"
0040 " .pushsection __jump_table, \"aw\" \n\t"
0041 " .align 3 \n\t"
0042 " .long 1b - ., %l[l_yes] - . \n\t"
0043 " .quad %c0 - . \n\t"
0044 " .popsection \n\t"
0045 : : "i"(&((char *)key)[branch]) : : l_yes);
0046
0047 return false;
0048 l_yes:
0049 return true;
0050 }
0051
0052 #endif
0053 #endif