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
7 #define JUMP_LABEL_NOP_SIZE 5
14 #include <linux/stringify.h>
15 #include <linux/types.h>
17 static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch)
19 asm_volatile_goto("1:"
20 ".byte " __stringify(BYTES_NOP5) "\n\t"
21 ".pushsection __jump_table, \"aw\" \n\t"
23 ".long 1b - ., %l[l_yes] - . \n\t"
24 _ASM_PTR "%c0 + %c1 - .\n\t"
26 : : "i" (key), "i" (branch) : : l_yes);
33 static __always_inline bool arch_static_branch_jump(struct static_key * const key, const bool branch)
35 asm_volatile_goto("1:"
36 ".byte 0xe9\n\t .long %l[l_yes] - 2f\n\t"
38 ".pushsection __jump_table, \"aw\" \n\t"
40 ".long 1b - ., %l[l_yes] - . \n\t"
41 _ASM_PTR "%c0 + %c1 - .\n\t"
43 : : "i" (key), "i" (branch) : : l_yes);
50 #endif /* __ASSEMBLY__ */