From aadff4375be332c8882761a6f8c6c84da1bff810 Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Fri, 5 Apr 2013 16:25:47 +0400 Subject: [PATCH] [REFACTOR] redesign arch_set_orig_ret_addr() --- uprobe/arch/asm-arm/swap_uprobes.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/uprobe/arch/asm-arm/swap_uprobes.c b/uprobe/arch/asm-arm/swap_uprobes.c index 33f3525..d3e14f2 100644 --- a/uprobe/arch/asm-arm/swap_uprobes.c +++ b/uprobe/arch/asm-arm/swap_uprobes.c @@ -643,13 +643,12 @@ unsigned long arch_get_trampoline_addr(struct kprobe *p, struct pt_regs *regs) void arch_set_orig_ret_addr(unsigned long orig_ret_addr, struct pt_regs *regs) { regs->ARM_lr = orig_ret_addr; - regs->ARM_pc = orig_ret_addr; + regs->ARM_pc = orig_ret_addr & ~0x1; - if (thumb_mode(regs) && !(regs->ARM_lr & 0x01)) { - regs->ARM_cpsr &= 0xFFFFFFDF; - } else if (user_mode(regs) && (regs->ARM_lr & 0x01)) { - regs->ARM_cpsr |= 0x20; - } + if (regs->ARM_lr & 0x1) + regs->ARM_cpsr |= PSR_T_BIT; + else + regs->ARM_cpsr &= ~PSR_T_BIT; } static int check_validity_insn(struct kprobe *p, struct pt_regs *regs) -- 2.7.4