xref: /linux/arch/arm/include/asm/probes.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*1802d0beSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2b2531dd5SDavid A. Long /*
3b2531dd5SDavid A. Long  * arch/arm/include/asm/probes.h
4b2531dd5SDavid A. Long  *
5b2531dd5SDavid A. Long  * Original contents copied from arch/arm/include/asm/kprobes.h
6b2531dd5SDavid A. Long  * which contains the following notice...
7b2531dd5SDavid A. Long  *
8b2531dd5SDavid A. Long  * Copyright (C) 2006, 2007 Motorola Inc.
9b2531dd5SDavid A. Long  */
10b2531dd5SDavid A. Long 
11b2531dd5SDavid A. Long #ifndef _ASM_PROBES_H
12b2531dd5SDavid A. Long #define _ASM_PROBES_H
13b2531dd5SDavid A. Long 
14a0266c21SWang Nan #ifndef __ASSEMBLY__
15a0266c21SWang Nan 
16f145d664SDavid A. Long typedef u32 probes_opcode_t;
17c18377c3SDavid A. Long 
18b4cd605cSDavid A. Long struct arch_probes_insn;
1947e190faSDavid A. Long typedef void (probes_insn_handler_t)(probes_opcode_t,
20b4cd605cSDavid A. Long 				     struct arch_probes_insn *,
217579f4b3SDavid A. Long 				     struct pt_regs *);
22f145d664SDavid A. Long typedef unsigned long (probes_check_cc)(unsigned long);
2347e190faSDavid A. Long typedef void (probes_insn_singlestep_t)(probes_opcode_t,
24b4cd605cSDavid A. Long 					struct arch_probes_insn *,
257579f4b3SDavid A. Long 					struct pt_regs *);
2647e190faSDavid A. Long typedef void (probes_insn_fn_t)(void);
27b2531dd5SDavid A. Long 
28b2531dd5SDavid A. Long /* Architecture specific copy of original instruction. */
29b4cd605cSDavid A. Long struct arch_probes_insn {
30f145d664SDavid A. Long 	probes_opcode_t			*insn;
3147e190faSDavid A. Long 	probes_insn_handler_t		*insn_handler;
32f145d664SDavid A. Long 	probes_check_cc			*insn_check_cc;
3347e190faSDavid A. Long 	probes_insn_singlestep_t	*insn_singlestep;
3447e190faSDavid A. Long 	probes_insn_fn_t		*insn_fn;
356624cf65SWang Nan 	int				stack_space;
3628a1899dSWang Nan 	unsigned long			register_usage_flags;
37bfc9657dSWang Nan 	bool				kprobe_direct_exec;
38b2531dd5SDavid A. Long };
39b2531dd5SDavid A. Long 
40a0266c21SWang Nan #endif /* __ASSEMBLY__ */
41a0266c21SWang Nan 
42a0266c21SWang Nan /*
43a0266c21SWang Nan  * We assume one instruction can consume at most 64 bytes stack, which is
44a0266c21SWang Nan  * 'push {r0-r15}'. Instructions consume more or unknown stack space like
45a0266c21SWang Nan  * 'str r0, [sp, #-80]' and 'str r0, [sp, r1]' should be prohibit to probe.
46a0266c21SWang Nan  */
47a0266c21SWang Nan #define MAX_STACK_SIZE			64
48a0266c21SWang Nan 
49b2531dd5SDavid A. Long #endif
50