[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 14/16] livepatch, arm[32|64]: Share arch_livepatch_revert_jmp
It is exactly the same in both platforms. No functional change. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> --- Cc: Julien Grall <julien.grall@xxxxxxx> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> v3: New submission. v4: s/arch_livepatch_insn_len/livepatch_insn_len/ s/PATCH_INSN_SIZE/ARCH_PATCH_INSN_SIZE/ --- xen/arch/arm/arm32/livepatch.c | 19 +------------------ xen/arch/arm/arm64/livepatch.c | 19 +------------------ xen/arch/arm/livepatch.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 36 deletions(-) diff --git a/xen/arch/arm/arm32/livepatch.c b/xen/arch/arm/arm32/livepatch.c index 6ad0ce5..606a00c 100644 --- a/xen/arch/arm/arm32/livepatch.c +++ b/xen/arch/arm/arm32/livepatch.c @@ -66,24 +66,7 @@ void arch_livepatch_apply_jmp(struct livepatch_func *func) clean_and_invalidate_dcache_va_range(func->old_addr, sizeof(*new_ptr) * len); } -void arch_livepatch_revert_jmp(const struct livepatch_func *func) -{ - uint32_t *new_ptr; - unsigned int i, len; - - new_ptr = func->old_addr - (void *)_start + vmap_of_xen_text; - len = livepatch_insn_len(func) / sizeof(uint32_t); - for ( i = 0; i < len; i++ ) - { - uint32_t insn; - - memcpy(&insn, func->opaque + (i * sizeof(uint32_t)), ARCH_PATCH_INSN_SIZE); - /* PATCH! */ - *(new_ptr + i) = insn; - } - - clean_and_invalidate_dcache_va_range(func->old_addr, sizeof(*new_ptr) * len); -} +/* arch_livepatch_revert_jmp shared with ARM 64. */ int arch_livepatch_verify_elf(const struct livepatch_elf *elf) { diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c index d53fe59..89d061e 100644 --- a/xen/arch/arm/arm64/livepatch.c +++ b/xen/arch/arm/arm64/livepatch.c @@ -53,24 +53,7 @@ void arch_livepatch_apply_jmp(struct livepatch_func *func) clean_and_invalidate_dcache_va_range(new_ptr, sizeof(*new_ptr) * len); } -void arch_livepatch_revert_jmp(const struct livepatch_func *func) -{ - uint32_t *new_ptr; - unsigned int i, len; - - new_ptr = func->old_addr - (void *)_start + vmap_of_xen_text; - len = livepatch_insn_len(func) / sizeof(uint32_t); - for ( i = 0; i < len; i++ ) - { - uint32_t insn; - - memcpy(&insn, func->opaque + (i * sizeof(uint32_t)), ARCH_PATCH_INSN_SIZE); - /* PATCH! */ - *(new_ptr + i) = insn; - } - - clean_and_invalidate_dcache_va_range(func->old_addr, sizeof(*new_ptr) * len); -} +/* arch_livepatch_revert_jmp shared with ARM32. */ int arch_livepatch_verify_elf(const struct livepatch_elf *elf) { diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c index 9c198e9..c77030e 100644 --- a/xen/arch/arm/livepatch.c +++ b/xen/arch/arm/livepatch.c @@ -69,6 +69,25 @@ int arch_livepatch_verify_func(const struct livepatch_func *func) return 0; } +void arch_livepatch_revert_jmp(const struct livepatch_func *func) +{ + uint32_t *new_ptr; + unsigned int i, len; + + new_ptr = func->old_addr - (void *)_start + vmap_of_xen_text; + len = livepatch_insn_len(func) / sizeof(uint32_t); + for ( i = 0; i < len; i++ ) + { + uint32_t insn; + + memcpy(&insn, func->opaque + (i * sizeof(uint32_t)), ARCH_PATCH_INSN_SIZE); + /* PATCH! */ + *(new_ptr + i) = insn; + } + + clean_and_invalidate_dcache_va_range(new_ptr, sizeof(*new_ptr) * len); +} + void arch_livepatch_post_action(void) { /* arch_livepatch_revive has nuked the instruction cache. */ -- 2.5.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |