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