1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_JUMP_LABEL_H
3 #define _ASM_X86_JUMP_LABEL_H
5 #define HAVE_JUMP_LABEL_BATCH
12 #include <linux/stringify.h>
13 #include <linux/types.h>
15 #define JUMP_TABLE_ENTRY \
16 ".pushsection __jump_table, \"aw\" \n\t" \
19 ".long %l[l_yes] - . \n\t" \
20 _ASM_PTR "%c0 + %c1 - .\n\t" \
23 #ifdef CONFIG_HAVE_JUMP_LABEL_HACK
25 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
27 asm_volatile_goto("1:"
28 "jmp %l[l_yes] # objtool NOPs this \n\t"
30 : : "i" (key), "i" (2 | branch) : : l_yes);
37 #else /* !CONFIG_HAVE_JUMP_LABEL_HACK */
39 static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch)
41 asm_volatile_goto("1:"
42 ".byte " __stringify(BYTES_NOP5) "\n\t"
44 : : "i" (key), "i" (branch) : : l_yes);
51 #endif /* CONFIG_HAVE_JUMP_LABEL_HACK */
53 static __always_inline bool arch_static_branch_jump(struct static_key * const key, const bool branch)
55 asm_volatile_goto("1:"
58 : : "i" (key), "i" (branch) : : l_yes);
65 extern int arch_jump_entry_size(struct jump_entry *entry);
67 #endif /* __ASSEMBLY__ */