diff options
author | Jiang Liu <liuj97@gmail.com> | 2014-01-07 09:17:09 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2014-01-08 10:21:29 -0500 |
commit | ae16480785de1da84f21d1698f304a52f9790c49 (patch) | |
tree | dc5ecc5f4c146c805321d1c226d47b4add3337d0 /arch/arm64/include | |
parent | b11a64a48ccc7ca0ceb33544206934fbd3cdbb22 (diff) |
arm64: introduce interfaces to hotpatch kernel and module code
Introduce three interfaces to patch kernel and module code:
aarch64_insn_patch_text_nosync():
patch code without synchronization, it's caller's responsibility
to synchronize all CPUs if needed.
aarch64_insn_patch_text_sync():
patch code and always synchronize with stop_machine()
aarch64_insn_patch_text():
patch code and synchronize with stop_machine() if needed
Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/include')
-rw-r--r-- | arch/arm64/include/asm/insn.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h index 1bdc44c27456..bf8085fdc140 100644 --- a/arch/arm64/include/asm/insn.h +++ b/arch/arm64/include/asm/insn.h | |||
@@ -18,6 +18,9 @@ | |||
18 | #define __ASM_INSN_H | 18 | #define __ASM_INSN_H |
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | 20 | ||
21 | /* A64 instructions are always 32 bits. */ | ||
22 | #define AARCH64_INSN_SIZE 4 | ||
23 | |||
21 | /* | 24 | /* |
22 | * ARM Architecture Reference Manual for ARMv8 Profile-A, Issue A.a | 25 | * ARM Architecture Reference Manual for ARMv8 Profile-A, Issue A.a |
23 | * Section C3.1 "A64 instruction index by encoding": | 26 | * Section C3.1 "A64 instruction index by encoding": |
@@ -70,8 +73,13 @@ __AARCH64_INSN_FUNCS(hint, 0xFFFFF01F, 0xD503201F) | |||
70 | 73 | ||
71 | bool aarch64_insn_is_nop(u32 insn); | 74 | bool aarch64_insn_is_nop(u32 insn); |
72 | 75 | ||
76 | int aarch64_insn_read(void *addr, u32 *insnp); | ||
77 | int aarch64_insn_write(void *addr, u32 insn); | ||
73 | enum aarch64_insn_encoding_class aarch64_get_insn_class(u32 insn); | 78 | enum aarch64_insn_encoding_class aarch64_get_insn_class(u32 insn); |
74 | |||
75 | bool aarch64_insn_hotpatch_safe(u32 old_insn, u32 new_insn); | 79 | bool aarch64_insn_hotpatch_safe(u32 old_insn, u32 new_insn); |
76 | 80 | ||
81 | int aarch64_insn_patch_text_nosync(void *addr, u32 insn); | ||
82 | int aarch64_insn_patch_text_sync(void *addrs[], u32 insns[], int cnt); | ||
83 | int aarch64_insn_patch_text(void *addrs[], u32 insns[], int cnt); | ||
84 | |||
77 | #endif /* __ASM_INSN_H */ | 85 | #endif /* __ASM_INSN_H */ |