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