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