~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm64/include/asm/debug-monitors.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2012 ARM Ltd.
  4  */
  5 #ifndef __ASM_DEBUG_MONITORS_H
  6 #define __ASM_DEBUG_MONITORS_H
  7 
  8 #include <linux/errno.h>
  9 #include <linux/types.h>
 10 #include <asm/brk-imm.h>
 11 #include <asm/esr.h>
 12 #include <asm/insn.h>
 13 #include <asm/ptrace.h>
 14 
 15 /* Low-level stepping controls. */
 16 #define DBG_MDSCR_SS            (1 << 0)
 17 #define DBG_SPSR_SS             (1 << 21)
 18 
 19 /* MDSCR_EL1 enabling bits */
 20 #define DBG_MDSCR_KDE           (1 << 13)
 21 #define DBG_MDSCR_MDE           (1 << 15)
 22 #define DBG_MDSCR_MASK          ~(DBG_MDSCR_KDE | DBG_MDSCR_MDE)
 23 
 24 #define DBG_ESR_EVT(x)          (((x) >> 27) & 0x7)
 25 
 26 /* AArch64 */
 27 #define DBG_ESR_EVT_HWBP        0x0
 28 #define DBG_ESR_EVT_HWSS        0x1
 29 #define DBG_ESR_EVT_HWWP        0x2
 30 #define DBG_ESR_EVT_BRK         0x6
 31 
 32 /*
 33  * Break point instruction encoding
 34  */
 35 #define BREAK_INSTR_SIZE                AARCH64_INSN_SIZE
 36 
 37 #define AARCH64_BREAK_KGDB_DYN_DBG      \
 38         (AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5))
 39 
 40 #define CACHE_FLUSH_IS_SAFE             1
 41 
 42 /* kprobes BRK opcodes with ESR encoding  */
 43 #define BRK64_OPCODE_KPROBES    (AARCH64_BREAK_MON | (KPROBES_BRK_IMM << 5))
 44 #define BRK64_OPCODE_KPROBES_SS (AARCH64_BREAK_MON | (KPROBES_BRK_SS_IMM << 5))
 45 /* uprobes BRK opcodes with ESR encoding  */
 46 #define BRK64_OPCODE_UPROBES    (AARCH64_BREAK_MON | (UPROBES_BRK_IMM << 5))
 47 
 48 /* AArch32 */
 49 #define DBG_ESR_EVT_BKPT        0x4
 50 #define DBG_ESR_EVT_VECC        0x5
 51 
 52 #define AARCH32_BREAK_ARM       0x07f001f0
 53 #define AARCH32_BREAK_THUMB     0xde01
 54 #define AARCH32_BREAK_THUMB2_LO 0xf7f0
 55 #define AARCH32_BREAK_THUMB2_HI 0xa000
 56 
 57 #ifndef __ASSEMBLY__
 58 struct task_struct;
 59 
 60 #define DBG_ARCH_ID_RESERVED    0       /* In case of ptrace ABI updates. */
 61 
 62 #define DBG_HOOK_HANDLED        0
 63 #define DBG_HOOK_ERROR          1
 64 
 65 struct step_hook {
 66         struct list_head node;
 67         int (*fn)(struct pt_regs *regs, unsigned long esr);
 68 };
 69 
 70 void register_user_step_hook(struct step_hook *hook);
 71 void unregister_user_step_hook(struct step_hook *hook);
 72 
 73 void register_kernel_step_hook(struct step_hook *hook);
 74 void unregister_kernel_step_hook(struct step_hook *hook);
 75 
 76 struct break_hook {
 77         struct list_head node;
 78         int (*fn)(struct pt_regs *regs, unsigned long esr);
 79         u16 imm;
 80         u16 mask; /* These bits are ignored when comparing with imm */
 81 };
 82 
 83 void register_user_break_hook(struct break_hook *hook);
 84 void unregister_user_break_hook(struct break_hook *hook);
 85 
 86 void register_kernel_break_hook(struct break_hook *hook);
 87 void unregister_kernel_break_hook(struct break_hook *hook);
 88 
 89 u8 debug_monitors_arch(void);
 90 
 91 enum dbg_active_el {
 92         DBG_ACTIVE_EL0 = 0,
 93         DBG_ACTIVE_EL1,
 94 };
 95 
 96 void enable_debug_monitors(enum dbg_active_el el);
 97 void disable_debug_monitors(enum dbg_active_el el);
 98 
 99 void user_rewind_single_step(struct task_struct *task);
100 void user_fastforward_single_step(struct task_struct *task);
101 void user_regs_reset_single_step(struct user_pt_regs *regs,
102                                  struct task_struct *task);
103 
104 void kernel_enable_single_step(struct pt_regs *regs);
105 void kernel_disable_single_step(void);
106 int kernel_active_single_step(void);
107 void kernel_rewind_single_step(struct pt_regs *regs);
108 
109 #ifdef CONFIG_HAVE_HW_BREAKPOINT
110 int reinstall_suspended_bps(struct pt_regs *regs);
111 #else
112 static inline int reinstall_suspended_bps(struct pt_regs *regs)
113 {
114         return -ENODEV;
115 }
116 #endif
117 
118 int aarch32_break_handler(struct pt_regs *regs);
119 
120 void debug_traps_init(void);
121 
122 #endif  /* __ASSEMBLY */
123 #endif  /* __ASM_DEBUG_MONITORS_H */
124 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php