xref: /linux/arch/arm/include/asm/uprobes.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2c7edc9e3SDavid A. Long /*
3c7edc9e3SDavid A. Long  * Copyright (C) 2012 Rabin Vincent <rabin at rab.in>
4c7edc9e3SDavid A. Long  */
5c7edc9e3SDavid A. Long 
6c7edc9e3SDavid A. Long #ifndef _ASM_UPROBES_H
7c7edc9e3SDavid A. Long #define _ASM_UPROBES_H
8c7edc9e3SDavid A. Long 
9c7edc9e3SDavid A. Long #include <asm/probes.h>
10c7edc9e3SDavid A. Long #include <asm/opcodes.h>
11c7edc9e3SDavid A. Long 
12c7edc9e3SDavid A. Long typedef u32 uprobe_opcode_t;
13c7edc9e3SDavid A. Long 
14c7edc9e3SDavid A. Long #define MAX_UINSN_BYTES		4
15c7edc9e3SDavid A. Long #define UPROBE_XOL_SLOT_BYTES	64
16c7edc9e3SDavid A. Long 
17c7edc9e3SDavid A. Long #define UPROBE_SWBP_ARM_INSN	0xe7f001f9
18c7edc9e3SDavid A. Long #define UPROBE_SS_ARM_INSN	0xe7f001fa
19c7edc9e3SDavid A. Long #define UPROBE_SWBP_INSN	__opcode_to_mem_arm(UPROBE_SWBP_ARM_INSN)
20c7edc9e3SDavid A. Long #define UPROBE_SWBP_INSN_SIZE	4
21c7edc9e3SDavid A. Long 
22c7edc9e3SDavid A. Long struct arch_uprobe_task {
23c7edc9e3SDavid A. Long 	u32 backup;
24c7edc9e3SDavid A. Long 	unsigned long	saved_trap_no;
25c7edc9e3SDavid A. Long };
26c7edc9e3SDavid A. Long 
27c7edc9e3SDavid A. Long struct arch_uprobe {
28c7edc9e3SDavid A. Long 	u8 insn[MAX_UINSN_BYTES];
29c7edc9e3SDavid A. Long 	unsigned long ixol[2];
30c7edc9e3SDavid A. Long 	uprobe_opcode_t bpinsn;
31c7edc9e3SDavid A. Long 	bool simulate;
32c7edc9e3SDavid A. Long 	u32 pcreg;
33c7edc9e3SDavid A. Long 	void (*prehandler)(struct arch_uprobe *auprobe,
34c7edc9e3SDavid A. Long 			   struct arch_uprobe_task *autask,
35c7edc9e3SDavid A. Long 			   struct pt_regs *regs);
36c7edc9e3SDavid A. Long 	void (*posthandler)(struct arch_uprobe *auprobe,
37c7edc9e3SDavid A. Long 			    struct arch_uprobe_task *autask,
38c7edc9e3SDavid A. Long 			    struct pt_regs *regs);
39c7edc9e3SDavid A. Long 	struct arch_probes_insn asi;
40c7edc9e3SDavid A. Long };
41c7edc9e3SDavid A. Long 
42c7edc9e3SDavid A. Long #endif
43