xref: /linux/arch/x86/include/asm/uprobes.h (revision 48dea9a700c8728cc31a1dd44588b97578de86ee)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _ASM_UPROBES_H
3 #define _ASM_UPROBES_H
4 /*
5  * User-space Probes (UProbes) for x86
6  *
7  * Copyright (C) IBM Corporation, 2008-2011
8  * Authors:
9  *	Srikar Dronamraju
10  *	Jim Keniston
11  */
12 
13 #include <linux/notifier.h>
14 
15 typedef u8 uprobe_opcode_t;
16 
17 #define MAX_UINSN_BYTES			  16
18 #define UPROBE_XOL_SLOT_BYTES		 128	/* to keep it cache aligned */
19 
20 #define UPROBE_SWBP_INSN		0xcc
21 #define UPROBE_SWBP_INSN_SIZE		   1
22 
23 struct uprobe_xol_ops;
24 
25 struct arch_uprobe {
26 	union {
27 		u8			insn[MAX_UINSN_BYTES];
28 		u8			ixol[MAX_UINSN_BYTES];
29 	};
30 
31 	const struct uprobe_xol_ops	*ops;
32 
33 	union {
34 		struct {
35 			s32	offs;
36 			u8	ilen;
37 			u8	opc1;
38 		}			branch;
39 		struct {
40 			u8	fixups;
41 			u8	ilen;
42 		} 			defparam;
43 		struct {
44 			u8	reg_offset;	/* to the start of pt_regs */
45 			u8	ilen;
46 		}			push;
47 	};
48 };
49 
50 struct arch_uprobe_task {
51 #ifdef CONFIG_X86_64
52 	unsigned long			saved_scratch_register;
53 #endif
54 	unsigned int			saved_trap_nr;
55 	unsigned int			saved_tf;
56 };
57 
58 #endif	/* _ASM_UPROBES_H */
59