Commit | Line | Data |
---|---|---|
d9f5ab7b JB |
1 | #ifndef _ASM_X86_JUMP_LABEL_H |
2 | #define _ASM_X86_JUMP_LABEL_H | |
3 | ||
4 | #ifdef __KERNEL__ | |
5 | ||
6 | #include <linux/types.h> | |
7 | #include <asm/nops.h> | |
d430d3d7 | 8 | #include <asm/asm.h> |
d9f5ab7b JB |
9 | |
10 | #define JUMP_LABEL_NOP_SIZE 5 | |
11 | ||
d430d3d7 JB |
12 | #define JUMP_LABEL_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t" |
13 | ||
14 | static __always_inline bool arch_static_branch(struct jump_label_key *key) | |
15 | { | |
16 | asm goto("1:" | |
17 | JUMP_LABEL_INITIAL_NOP | |
18 | ".pushsection __jump_table, \"aw\" \n\t" | |
19 | _ASM_PTR "1b, %l[l_yes], %c0 \n\t" | |
20 | ".popsection \n\t" | |
21 | : : "i" (key) : : l_yes); | |
22 | return false; | |
23 | l_yes: | |
24 | return true; | |
25 | } | |
d9f5ab7b JB |
26 | |
27 | #endif /* __KERNEL__ */ | |
28 | ||
29 | #ifdef CONFIG_X86_64 | |
d9f5ab7b | 30 | typedef u64 jump_label_t; |
d9f5ab7b | 31 | #else |
d9f5ab7b | 32 | typedef u32 jump_label_t; |
95fccd46 | 33 | #endif |
d9f5ab7b JB |
34 | |
35 | struct jump_entry { | |
36 | jump_label_t code; | |
37 | jump_label_t target; | |
38 | jump_label_t key; | |
39 | }; | |
40 | ||
41 | #endif |