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
15typedef 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
23enum {
24 ARCH_UPROBE_FLAG_CAN_OPTIMIZE = 0,
25 ARCH_UPROBE_FLAG_OPTIMIZE_FAIL = 1,
26};
27
28struct uprobe_xol_ops;
29
30struct arch_uprobe {
31 union {
32 u8 insn[MAX_UINSN_BYTES];
33 u8 ixol[MAX_UINSN_BYTES];
34 };
35
36 const struct uprobe_xol_ops *ops;
37
38 union {
39 struct {
40 s32 offs;
41 u8 ilen;
42 u8 opc1;
43 } branch;
44 struct {
45 u8 fixups;
46 u8 ilen;
47 } defparam;
48 struct {
49 u8 reg_offset; /* to the start of pt_regs */
50 u8 ilen;
51 } push;
52 };
53
54 unsigned long flags;
55};
56
57struct arch_uprobe_task {
58#ifdef CONFIG_X86_64
59 unsigned long saved_scratch_register;
60#endif
61 unsigned int saved_trap_nr;
62 unsigned int saved_tf;
63};
64
65#endif /* _ASM_UPROBES_H */
66