Linux 5.7.7
[linux/fpc-iii.git] / arch / arm / kernel / jump_label.c
blob303b3ab87f7e892a4607055eae136582372745cf
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/kernel.h>
3 #include <linux/jump_label.h>
4 #include <asm/patch.h>
5 #include <asm/insn.h>
7 static void __arch_jump_label_transform(struct jump_entry *entry,
8 enum jump_label_type type,
9 bool is_static)
11 void *addr = (void *)entry->code;
12 unsigned int insn;
14 if (type == JUMP_LABEL_JMP)
15 insn = arm_gen_branch(entry->code, entry->target);
16 else
17 insn = arm_gen_nop();
19 if (is_static)
20 __patch_text_early(addr, insn);
21 else
22 patch_text(addr, insn);
25 void arch_jump_label_transform(struct jump_entry *entry,
26 enum jump_label_type type)
28 __arch_jump_label_transform(entry, type, false);
31 void arch_jump_label_transform_static(struct jump_entry *entry,
32 enum jump_label_type type)
34 __arch_jump_label_transform(entry, type, true);