Loading...
1#include <linux/kernel.h>
2#include <linux/jump_label.h>
3
4#include "insn.h"
5#include "patch.h"
6
7#ifdef HAVE_JUMP_LABEL
8
9static void __arch_jump_label_transform(struct jump_entry *entry,
10 enum jump_label_type type,
11 bool is_static)
12{
13 void *addr = (void *)entry->code;
14 unsigned int insn;
15
16 if (type == JUMP_LABEL_ENABLE)
17 insn = arm_gen_branch(entry->code, entry->target);
18 else
19 insn = arm_gen_nop();
20
21 if (is_static)
22 __patch_text(addr, insn);
23 else
24 patch_text(addr, insn);
25}
26
27void arch_jump_label_transform(struct jump_entry *entry,
28 enum jump_label_type type)
29{
30 __arch_jump_label_transform(entry, type, false);
31}
32
33void arch_jump_label_transform_static(struct jump_entry *entry,
34 enum jump_label_type type)
35{
36 __arch_jump_label_transform(entry, type, true);
37}
38
39#endif
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/kernel.h>
3#include <linux/jump_label.h>
4#include <asm/text-patching.h>
5#include <asm/insn.h>
6
7static void __arch_jump_label_transform(struct jump_entry *entry,
8 enum jump_label_type type,
9 bool is_static)
10{
11 void *addr = (void *)entry->code;
12 unsigned int insn;
13
14 if (type == JUMP_LABEL_JMP)
15 insn = arm_gen_branch(entry->code, entry->target);
16 else
17 insn = arm_gen_nop();
18
19 if (is_static)
20 __patch_text_early(addr, insn);
21 else
22 patch_text(addr, insn);
23}
24
25void arch_jump_label_transform(struct jump_entry *entry,
26 enum jump_label_type type)
27{
28 __arch_jump_label_transform(entry, type, false);
29}