]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
ARM: kprobes: Move find_str_pc_offset into kprobes-common.c
authorJon Medhurst <tixy@yxit.co.uk>
Thu, 7 Jul 2011 09:21:40 +0000 (10:21 +0100)
committerTixy <tixy@medhuaa1.miniserver.com>
Wed, 13 Jul 2011 17:32:41 +0000 (17:32 +0000)
Move str_pc_offset into kprobes-common.c as it will be needed by common
code later.

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
arch/arm/kernel/kprobes-arm.c
arch/arm/kernel/kprobes-common.c
arch/arm/kernel/kprobes.h

index 3c4678edcbf8d4c06b9257dc6dcb6f9375bb4de7..0262b29163d1859ae2461bb5eab2f787853ac1b7 100644 (file)
@@ -91,29 +91,6 @@ union reg_pair {
 #endif
 };
 
-/*
- * For STR and STM instructions, an ARM core may choose to use either
- * a +8 or a +12 displacement from the current instruction's address.
- * Whichever value is chosen for a given core, it must be the same for
- * both instructions and may not change.  This function measures it.
- */
-
-static int str_pc_offset;
-
-static void __init find_str_pc_offset(void)
-{
-       int addr, scratch, ret;
-
-       __asm__ (
-               "sub    %[ret], pc, #4          \n\t"
-               "str    pc, %[addr]             \n\t"
-               "ldr    %[scr], %[addr]         \n\t"
-               "sub    %[ret], %[scr], %[ret]  \n\t"
-               : [ret] "=r" (ret), [scr] "=r" (scratch), [addr] "+m" (addr));
-
-       str_pc_offset = ret;
-}
-
 /*
  * The insnslot_?arg_r[w]flags() functions below are to keep the
  * msr -> *fn -> mrs instruction sequences indivisible so that
@@ -1569,8 +1546,3 @@ arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
 
        return space_cccc_11xx(insn, asi);
 }
-
-void __init arm_kprobe_decode_init(void)
-{
-       find_str_pc_offset();
-}
index 794827ec27d7dbdd5b4406eb96eb2856fdc263a1..e18576cca6cf65cb029c48111398938eb4cbc143 100644 (file)
@@ -3,6 +3,9 @@
  *
  * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
  *
+ * Some contents moved here from arch/arm/include/asm/kprobes-arm.c which is
+ * Copyright (C) 2006, 2007 Motorola Inc.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
 #include "kprobes.h"
 
 
+/*
+ * For STR and STM instructions, an ARM core may choose to use either
+ * a +8 or a +12 displacement from the current instruction's address.
+ * Whichever value is chosen for a given core, it must be the same for
+ * both instructions and may not change.  This function measures it.
+ */
+
+int str_pc_offset;
+
+void __init find_str_pc_offset(void)
+{
+       int addr, scratch, ret;
+
+       __asm__ (
+               "sub    %[ret], pc, #4          \n\t"
+               "str    pc, %[addr]             \n\t"
+               "ldr    %[scr], %[addr]         \n\t"
+               "sub    %[ret], %[scr], %[ret]  \n\t"
+               : [ret] "=r" (ret), [scr] "=r" (scratch), [addr] "+m" (addr));
+
+       str_pc_offset = ret;
+}
+
+
+void __init arm_kprobe_decode_init(void)
+{
+       find_str_pc_offset();
+}
+
+
 static unsigned long __kprobes __check_eq(unsigned long cpsr)
 {
        return cpsr & PSR_Z_BIT;
index 4de2f37b1a85492b14106069478016fc620ea53e..43f630d7f03de49df941f5c4211f89bb5d5f6db6 100644 (file)
@@ -36,6 +36,8 @@ void __init arm_kprobe_decode_init(void);
 
 extern kprobe_check_cc * const kprobe_condition_checks[16];
 
+extern int str_pc_offset;
+
 /*
  * Test if load/store instructions writeback the address register.
  * if P (bit 24) == 0 or W (bit 21) == 1