Path: blob/master/arch/arm64/include/asm/debug-monitors.h
26481 views
/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright (C) 2012 ARM Ltd.3*/4#ifndef __ASM_DEBUG_MONITORS_H5#define __ASM_DEBUG_MONITORS_H67#include <linux/errno.h>8#include <linux/types.h>9#include <asm/brk-imm.h>10#include <asm/esr.h>11#include <asm/insn.h>12#include <asm/ptrace.h>1314/* Low-level stepping controls. */15#define DBG_SPSR_SS (1 << 21)1617#define DBG_ESR_EVT(x) (((x) >> 27) & 0x7)1819/* AArch64 */20#define DBG_ESR_EVT_HWBP 0x021#define DBG_ESR_EVT_HWSS 0x122#define DBG_ESR_EVT_HWWP 0x223#define DBG_ESR_EVT_BRK 0x62425/*26* Break point instruction encoding27*/28#define BREAK_INSTR_SIZE AARCH64_INSN_SIZE2930#define AARCH64_BREAK_KGDB_DYN_DBG \31(AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5))3233#define CACHE_FLUSH_IS_SAFE 13435/* kprobes BRK opcodes with ESR encoding */36#define BRK64_OPCODE_KPROBES (AARCH64_BREAK_MON | (KPROBES_BRK_IMM << 5))37#define BRK64_OPCODE_KPROBES_SS (AARCH64_BREAK_MON | (KPROBES_BRK_SS_IMM << 5))38/* uprobes BRK opcodes with ESR encoding */39#define BRK64_OPCODE_UPROBES (AARCH64_BREAK_MON | (UPROBES_BRK_IMM << 5))4041/* AArch32 */42#define DBG_ESR_EVT_BKPT 0x443#define DBG_ESR_EVT_VECC 0x54445#define AARCH32_BREAK_ARM 0x07f001f046#define AARCH32_BREAK_THUMB 0xde0147#define AARCH32_BREAK_THUMB2_LO 0xf7f048#define AARCH32_BREAK_THUMB2_HI 0xa0004950#ifndef __ASSEMBLY__51struct task_struct;5253#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */5455#define DBG_HOOK_HANDLED 056#define DBG_HOOK_ERROR 15758u8 debug_monitors_arch(void);5960enum dbg_active_el {61DBG_ACTIVE_EL0 = 0,62DBG_ACTIVE_EL1,63};6465void enable_debug_monitors(enum dbg_active_el el);66void disable_debug_monitors(enum dbg_active_el el);6768void user_rewind_single_step(struct task_struct *task);69void user_fastforward_single_step(struct task_struct *task);70void user_regs_reset_single_step(struct user_pt_regs *regs,71struct task_struct *task);7273void kernel_enable_single_step(struct pt_regs *regs);74void kernel_disable_single_step(void);75int kernel_active_single_step(void);76void kernel_rewind_single_step(struct pt_regs *regs);77void kernel_fastforward_single_step(struct pt_regs *regs);7879#ifdef CONFIG_HAVE_HW_BREAKPOINT80bool try_step_suspended_breakpoints(struct pt_regs *regs);81#else82static inline bool try_step_suspended_breakpoints(struct pt_regs *regs)83{84return false;85}86#endif8788bool try_handle_aarch32_break(struct pt_regs *regs);8990#endif /* __ASSEMBLY */91#endif /* __ASM_DEBUG_MONITORS_H */929394