|
@@ -3,6 +3,9 @@
|
|
*
|
|
*
|
|
* Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
|
|
* 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
|
|
* 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
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
* published by the Free Software Foundation.
|
|
@@ -14,6 +17,36 @@
|
|
#include "kprobes.h"
|
|
#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)
|
|
static unsigned long __kprobes __check_eq(unsigned long cpsr)
|
|
{
|
|
{
|
|
return cpsr & PSR_Z_BIT;
|
|
return cpsr & PSR_Z_BIT;
|