xref: /openbmc/linux/arch/arm/probes/kprobes/core.h (revision 4e1c0664)
1fca08f32SWang Nan /*
2fca08f32SWang Nan  * arch/arm/kernel/kprobes.h
3fca08f32SWang Nan  *
4fca08f32SWang Nan  * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
5fca08f32SWang Nan  *
6fca08f32SWang Nan  * Some contents moved here from arch/arm/include/asm/kprobes.h which is
7fca08f32SWang Nan  * Copyright (C) 2006, 2007 Motorola Inc.
8fca08f32SWang Nan  *
9fca08f32SWang Nan  * This program is free software; you can redistribute it and/or modify
10fca08f32SWang Nan  * it under the terms of the GNU General Public License version 2 as
11fca08f32SWang Nan  * published by the Free Software Foundation.
12fca08f32SWang Nan  *
13fca08f32SWang Nan  * This program is distributed in the hope that it will be useful,
14fca08f32SWang Nan  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15fca08f32SWang Nan  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16fca08f32SWang Nan  * General Public License for more details.
17fca08f32SWang Nan  */
18fca08f32SWang Nan 
19fca08f32SWang Nan #ifndef _ARM_KERNEL_KPROBES_H
20fca08f32SWang Nan #define _ARM_KERNEL_KPROBES_H
21fca08f32SWang Nan 
22fca08f32SWang Nan #include <asm/kprobes.h>
23fca08f32SWang Nan #include "../decode.h"
24fca08f32SWang Nan 
25fca08f32SWang Nan /*
26fca08f32SWang Nan  * These undefined instructions must be unique and
27fca08f32SWang Nan  * reserved solely for kprobes' use.
28fca08f32SWang Nan  */
29fca08f32SWang Nan #define KPROBE_ARM_BREAKPOINT_INSTRUCTION	0x07f001f8
30fca08f32SWang Nan #define KPROBE_THUMB16_BREAKPOINT_INSTRUCTION	0xde18
31fca08f32SWang Nan #define KPROBE_THUMB32_BREAKPOINT_INSTRUCTION	0xf7f0a018
32fca08f32SWang Nan 
330dc016dbSWang Nan extern void kprobes_remove_breakpoint(void *addr, unsigned int insn);
340dc016dbSWang Nan 
35fca08f32SWang Nan enum probes_insn __kprobes
36fca08f32SWang Nan kprobe_decode_ldmstm(kprobe_opcode_t insn, struct arch_probes_insn *asi,
37fca08f32SWang Nan 		const struct decode_header *h);
38fca08f32SWang Nan 
39fca08f32SWang Nan typedef enum probes_insn (kprobe_decode_insn_t)(probes_opcode_t,
40fca08f32SWang Nan 						struct arch_probes_insn *,
41fca08f32SWang Nan 						bool,
4283803d97SWang Nan 						const union decode_action *,
434e1c0664SJon Medhurst 						const struct decode_checker *[]);
44fca08f32SWang Nan 
45fca08f32SWang Nan #ifdef CONFIG_THUMB2_KERNEL
46fca08f32SWang Nan 
47fca08f32SWang Nan extern const union decode_action kprobes_t32_actions[];
48fca08f32SWang Nan extern const union decode_action kprobes_t16_actions[];
4983803d97SWang Nan extern const struct decode_checker *kprobes_t32_checkers[];
5083803d97SWang Nan extern const struct decode_checker *kprobes_t16_checkers[];
51fca08f32SWang Nan #else /* !CONFIG_THUMB2_KERNEL */
52fca08f32SWang Nan 
53fca08f32SWang Nan extern const union decode_action kprobes_arm_actions[];
5483803d97SWang Nan extern const struct decode_checker *kprobes_arm_checkers[];
55fca08f32SWang Nan 
56fca08f32SWang Nan #endif
57fca08f32SWang Nan 
58fca08f32SWang Nan #endif /* _ARM_KERNEL_KPROBES_H */
59