xref: /linux/arch/arm/include/asm/probes.h (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
1 /*
2  * arch/arm/include/asm/probes.h
3  *
4  * Original contents copied from arch/arm/include/asm/kprobes.h
5  * which contains the following notice...
6  *
7  * Copyright (C) 2006, 2007 Motorola Inc.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  */
18 
19 #ifndef _ASM_PROBES_H
20 #define _ASM_PROBES_H
21 
22 #ifndef __ASSEMBLY__
23 
24 typedef u32 probes_opcode_t;
25 
26 struct arch_probes_insn;
27 typedef void (probes_insn_handler_t)(probes_opcode_t,
28 				     struct arch_probes_insn *,
29 				     struct pt_regs *);
30 typedef unsigned long (probes_check_cc)(unsigned long);
31 typedef void (probes_insn_singlestep_t)(probes_opcode_t,
32 					struct arch_probes_insn *,
33 					struct pt_regs *);
34 typedef void (probes_insn_fn_t)(void);
35 
36 /* Architecture specific copy of original instruction. */
37 struct arch_probes_insn {
38 	probes_opcode_t			*insn;
39 	probes_insn_handler_t		*insn_handler;
40 	probes_check_cc			*insn_check_cc;
41 	probes_insn_singlestep_t	*insn_singlestep;
42 	probes_insn_fn_t		*insn_fn;
43 	int				stack_space;
44 	unsigned long			register_usage_flags;
45 	bool				kprobe_direct_exec;
46 };
47 
48 #endif /* __ASSEMBLY__ */
49 
50 /*
51  * We assume one instruction can consume at most 64 bytes stack, which is
52  * 'push {r0-r15}'. Instructions consume more or unknown stack space like
53  * 'str r0, [sp, #-80]' and 'str r0, [sp, r1]' should be prohibit to probe.
54  * Both kprobe and jprobe use this macro.
55  */
56 #define MAX_STACK_SIZE			64
57 
58 #endif
59