aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/jump_label.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
index 2ad029876c8c..ea9d5f2f13ef 100644
--- a/arch/x86/kernel/jump_label.c
+++ b/arch/x86/kernel/jump_label.c
@@ -24,8 +24,9 @@ union jump_code_union {
24 } __attribute__((packed)); 24 } __attribute__((packed));
25}; 25};
26 26
27void arch_jump_label_transform(struct jump_entry *entry, 27static void __jump_label_transform(struct jump_entry *entry,
28 enum jump_label_type type) 28 enum jump_label_type type,
29 void *(*poker)(void *, const void *, size_t))
29{ 30{
30 union jump_code_union code; 31 union jump_code_union code;
31 32
@@ -35,11 +36,24 @@ void arch_jump_label_transform(struct jump_entry *entry,
35 (entry->code + JUMP_LABEL_NOP_SIZE); 36 (entry->code + JUMP_LABEL_NOP_SIZE);
36 } else 37 } else
37 memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE); 38 memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE);
39
40 (*poker)((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE);
41}
42
43void arch_jump_label_transform(struct jump_entry *entry,
44 enum jump_label_type type)
45{
38 get_online_cpus(); 46 get_online_cpus();
39 mutex_lock(&text_mutex); 47 mutex_lock(&text_mutex);
40 text_poke_smp((void *)entry->code, &code, JUMP_LABEL_NOP_SIZE); 48 __jump_label_transform(entry, type, text_poke_smp);
41 mutex_unlock(&text_mutex); 49 mutex_unlock(&text_mutex);
42 put_online_cpus(); 50 put_online_cpus();
43} 51}
44 52
53void arch_jump_label_transform_static(struct jump_entry *entry,
54 enum jump_label_type type)
55{
56 __jump_label_transform(entry, type, text_poke_early);
57}
58
45#endif 59#endif