[FIX] set correct CPU mode 45/59245/2
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 11 Feb 2016 17:28:55 +0000 (20:28 +0300)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 12 Feb 2016 13:32:14 +0000 (05:32 -0800)
Change-Id: I202c34f31152126eedd8f53303444bbd98816c45
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
kprobe/arch/arm/swap-asm/swap_kprobes.h
preload/preload_module.c

index 7eb0834..b961a0c 100644 (file)
@@ -166,7 +166,7 @@ static inline void swap_set_stack_ptr(struct pt_regs *regs, unsigned long sp)
  */
 static inline unsigned long swap_get_instr_ptr(struct pt_regs *regs)
 {
-       return regs->ARM_pc;
+       return regs->ARM_pc | !!thumb_mode(regs);
 }
 
 /**
@@ -178,7 +178,13 @@ static inline unsigned long swap_get_instr_ptr(struct pt_regs *regs)
  */
 static inline void swap_set_instr_ptr(struct pt_regs *regs, unsigned long val)
 {
-       regs->ARM_pc = val;
+       if (val & 1) {
+               regs->ARM_pc = val & ~1;
+               regs->ARM_cpsr |= PSR_T_BIT;
+       } else {
+               regs->ARM_pc = val;
+               regs->ARM_cpsr &= ~PSR_T_BIT;
+       }
 }
 
 /**
index e155149..0071a7b 100644 (file)
@@ -116,10 +116,8 @@ static inline void __prepare_ujump(struct uretprobe_instance *ri,
        swap_set_instr_ptr(regs, vaddr);
 
 #ifdef CONFIG_ARM
-       if (thumb_mode(regs)) {
-               regs->ARM_cpsr &= ~PSR_T_BIT;
+       if (thumb_mode(regs))
                ri->preload_thumb = 1;
-       }
 #endif /* CONFIG_ARM */
 }