Jon Medhurst | 221bf15 | 2011-04-20 10:52:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/kernel/kprobes.h |
| 3 | * |
| 4 | * Contents moved from arch/arm/include/asm/kprobes.h which is |
| 5 | * Copyright (C) 2006, 2007 Motorola Inc. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _ARM_KERNEL_KPROBES_H |
| 18 | #define _ARM_KERNEL_KPROBES_H |
| 19 | |
| 20 | /* |
| 21 | * This undefined instruction must be unique and |
| 22 | * reserved solely for kprobes' use. |
| 23 | */ |
| 24 | #define KPROBE_BREAKPOINT_INSTRUCTION 0xe7f001f8 |
| 25 | |
| 26 | enum kprobe_insn { |
| 27 | INSN_REJECTED, |
| 28 | INSN_GOOD, |
| 29 | INSN_GOOD_NO_SLOT |
| 30 | }; |
| 31 | |
| 32 | enum kprobe_insn arm_kprobe_decode_insn(kprobe_opcode_t, |
| 33 | struct arch_specific_insn *); |
| 34 | |
| 35 | void __init arm_kprobe_decode_init(void); |
| 36 | |
Jon Medhurst | 0ab4c02 | 2011-07-06 11:25:18 +0100 | [diff] [blame] | 37 | extern kprobe_check_cc * const kprobe_condition_checks[16]; |
| 38 | |
Jon Medhurst | aea4902 | 2011-07-07 19:58:29 +0100 | [diff] [blame^] | 39 | |
| 40 | #if __LINUX_ARM_ARCH__ >= 7 |
| 41 | |
| 42 | /* str_pc_offset is architecturally defined from ARMv7 onwards */ |
| 43 | #define str_pc_offset 8 |
| 44 | #define find_str_pc_offset() |
| 45 | |
| 46 | #else /* __LINUX_ARM_ARCH__ < 7 */ |
| 47 | |
| 48 | /* We need a run-time check to determine str_pc_offset */ |
Jon Medhurst | 6c8df33 | 2011-07-07 10:21:40 +0100 | [diff] [blame] | 49 | extern int str_pc_offset; |
Jon Medhurst | aea4902 | 2011-07-07 19:58:29 +0100 | [diff] [blame^] | 50 | void __init find_str_pc_offset(void); |
| 51 | |
| 52 | #endif |
| 53 | |
Jon Medhurst | 6c8df33 | 2011-07-07 10:21:40 +0100 | [diff] [blame] | 54 | |
Jon Medhurst | 1b59d87 | 2011-07-06 20:33:41 +0100 | [diff] [blame] | 55 | /* |
| 56 | * Test if load/store instructions writeback the address register. |
| 57 | * if P (bit 24) == 0 or W (bit 21) == 1 |
| 58 | */ |
| 59 | #define is_writeback(insn) ((insn ^ 0x01000000) & 0x01200000) |
| 60 | |
Jon Medhurst | 221bf15 | 2011-04-20 10:52:38 +0100 | [diff] [blame] | 61 | #endif /* _ARM_KERNEL_KPROBES_H */ |