Rabin Vincent | 09f05d8 | 2012-02-18 17:52:41 +0100 | [diff] [blame] | 1 | #include <linux/kernel.h> |
| 2 | #include <linux/jump_label.h> |
Wang Nan | fca08f3 | 2015-01-09 10:19:49 +0800 | [diff] [blame] | 3 | #include <asm/patch.h> |
Wang Nan | 0dc016d | 2015-01-09 14:37:36 +0800 | [diff] [blame] | 4 | #include <asm/insn.h> |
Rabin Vincent | 09f05d8 | 2012-02-18 17:52:41 +0100 | [diff] [blame] | 5 | |
| 6 | #ifdef HAVE_JUMP_LABEL |
| 7 | |
| 8 | static void __arch_jump_label_transform(struct jump_entry *entry, |
| 9 | enum jump_label_type type, |
| 10 | bool is_static) |
| 11 | { |
| 12 | void *addr = (void *)entry->code; |
| 13 | unsigned int insn; |
| 14 | |
| 15 | if (type == JUMP_LABEL_ENABLE) |
| 16 | insn = arm_gen_branch(entry->code, entry->target); |
| 17 | else |
| 18 | insn = arm_gen_nop(); |
| 19 | |
| 20 | if (is_static) |
Rabin Vincent | ab0615e | 2014-04-24 23:28:57 +0200 | [diff] [blame] | 21 | __patch_text_early(addr, insn); |
Rabin Vincent | 09f05d8 | 2012-02-18 17:52:41 +0100 | [diff] [blame] | 22 | else |
| 23 | patch_text(addr, insn); |
| 24 | } |
| 25 | |
| 26 | void arch_jump_label_transform(struct jump_entry *entry, |
| 27 | enum jump_label_type type) |
| 28 | { |
| 29 | __arch_jump_label_transform(entry, type, false); |
| 30 | } |
| 31 | |
| 32 | void arch_jump_label_transform_static(struct jump_entry *entry, |
| 33 | enum jump_label_type type) |
| 34 | { |
| 35 | __arch_jump_label_transform(entry, type, true); |
| 36 | } |
| 37 | |
| 38 | #endif |