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