1 #ifndef _LINUX_JUMP_LABEL_H
2 #define _LINUX_JUMP_LABEL_H
49 #include <linux/types.h>
50 #include <linux/compiler.h>
53 #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
60 struct static_key_mod *
next;
70 # include <asm/jump_label.h>
71 # define HAVE_JUMP_LABEL
81 #ifdef HAVE_JUMP_LABEL
83 #define JUMP_LABEL_TRUE_BRANCH 1UL
89 & ~JUMP_LABEL_TRUE_BRANCH);
92 static inline bool jump_label_get_branch_default(
struct static_key *key)
94 if ((
unsigned long)key->entries & JUMP_LABEL_TRUE_BRANCH)
101 return arch_static_branch(key);
106 return !static_key_false(key);
109 extern struct jump_entry __start___jump_table[];
110 extern struct jump_entry __stop___jump_table[];
112 extern void jump_label_init(
void);
113 extern void jump_label_lock(
void);
114 extern void jump_label_unlock(
void);
119 extern int jump_label_text_reserved(
void *
start,
void *
end);
120 extern void static_key_slow_inc(
struct static_key *key);
121 extern void static_key_slow_dec(
struct static_key *key);
123 extern void jump_label_apply_nops(
struct module *
mod);
127 #define STATIC_KEY_INIT_TRUE ((struct static_key) \
128 { .enabled = ATOMIC_INIT(1), .entries = (void *)1 })
129 #define STATIC_KEY_INIT_FALSE ((struct static_key) \
130 { .enabled = ATOMIC_INIT(0), .entries = (void *)0 })
162 static inline void static_key_slow_inc(
struct static_key *key)
167 static inline void static_key_slow_dec(
struct static_key *key)
174 static_key_slow_dec(&key->
key);
177 static inline int jump_label_text_reserved(
void *
start,
void *
end)
182 static inline void jump_label_lock(
void) {}
183 static inline void jump_label_unlock(
void) {}
185 static inline int jump_label_apply_nops(
struct module *
mod)
196 #define STATIC_KEY_INIT_TRUE ((struct static_key) \
197 { .enabled = ATOMIC_INIT(1) })
198 #define STATIC_KEY_INIT_FALSE ((struct static_key) \
199 { .enabled = ATOMIC_INIT(0) })
203 #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
204 #define jump_label_enabled static_key_enabled
206 static inline bool static_key_enabled(
struct static_key *key)