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