blob: 678fb546f0a75c9ff02fddc73003b93559476cc0 [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Srikar Dronamraju2b144492012-02-09 14:56:42 +05302#ifndef _ASM_UPROBES_H
3#define _ASM_UPROBES_H
4/*
Ingo Molnar7b2d81d2012-02-17 09:27:41 +01005 * User-space Probes (UProbes) for x86
Srikar Dronamraju2b144492012-02-09 14:56:42 +05306 *
Srikar Dronamraju2b144492012-02-09 14:56:42 +05307 * Copyright (C) IBM Corporation, 2008-2011
8 * Authors:
9 * Srikar Dronamraju
10 * Jim Keniston
11 */
12
Srikar Dronamraju0326f5a2012-03-13 23:30:11 +053013#include <linux/notifier.h>
14
Srikar Dronamraju2b144492012-02-09 14:56:42 +053015typedef u8 uprobe_opcode_t;
Srikar Dronamraju2b144492012-02-09 14:56:42 +053016
Ingo Molnar7b2d81d2012-02-17 09:27:41 +010017#define MAX_UINSN_BYTES 16
Srikar Dronamraju900771a2012-03-12 14:55:14 +053018#define UPROBE_XOL_SLOT_BYTES 128 /* to keep it cache aligned */
Ingo Molnar7b2d81d2012-02-17 09:27:41 +010019
Srikar Dronamraju5cb4ac32012-03-12 14:55:45 +053020#define UPROBE_SWBP_INSN 0xcc
21#define UPROBE_SWBP_INSN_SIZE 1
Srikar Dronamraju2b144492012-02-09 14:56:42 +053022
Oleg Nesterov8ad8e9d2014-03-31 21:01:31 +020023struct uprobe_xol_ops;
24
Srikar Dronamraju3ff54ef2012-02-22 14:46:02 +053025struct arch_uprobe {
Oleg Nesterov8a8de662013-11-04 20:27:13 +010026 union {
27 u8 insn[MAX_UINSN_BYTES];
28 u8 ixol[MAX_UINSN_BYTES];
29 };
Oleg Nesterov8ad8e9d2014-03-31 21:01:31 +020030
Oleg Nesterov8ad8e9d2014-03-31 21:01:31 +020031 const struct uprobe_xol_ops *ops;
32
Oleg Nesterov7ba6db22014-04-05 20:05:02 +020033 union {
Oleg Nesterov7ba6db22014-04-05 20:05:02 +020034 struct {
35 s32 offs;
36 u8 ilen;
Oleg Nesterov8e89c0b2014-04-06 18:11:02 +020037 u8 opc1;
Oleg Nesterov97aa5cd2014-04-22 16:20:55 +020038 } branch;
39 struct {
Oleg Nesterov78d9af42014-04-24 18:52:37 +020040 u8 fixups;
Oleg Nesterov1dc76e62014-04-25 18:06:19 +020041 u8 ilen;
Oleg Nesterov5cdb76d2014-06-01 21:13:46 +020042 } defparam;
Yonghong Songe7ed9d92017-11-30 16:12:02 -080043 struct {
44 u8 reg_offset; /* to the start of pt_regs */
45 u8 ilen;
46 } push;
Oleg Nesterov7ba6db22014-04-05 20:05:02 +020047 };
Srikar Dronamraju2b144492012-02-09 14:56:42 +053048};
49
Srikar Dronamraju0326f5a2012-03-13 23:30:11 +053050struct arch_uprobe_task {
Srikar Dronamraju0326f5a2012-03-13 23:30:11 +053051#ifdef CONFIG_X86_64
52 unsigned long saved_scratch_register;
53#endif
Oleg Nesterovbaedbf02012-09-03 17:02:16 +020054 unsigned int saved_trap_nr;
Oleg Nesterov3a4664a2012-09-03 16:05:10 +020055 unsigned int saved_tf;
Srikar Dronamraju0326f5a2012-03-13 23:30:11 +053056};
57
Srikar Dronamraju2b144492012-02-09 14:56:42 +053058#endif /* _ASM_UPROBES_H */