1 #ifndef _ARM_HW_BREAKPOINT_H
2 #define _ARM_HW_BREAKPOINT_H
8 #ifdef CONFIG_HAVE_HW_BREAKPOINT
10 struct arch_hw_breakpoint_ctrl {
23 struct arch_hw_breakpoint_ctrl step_ctrl;
24 struct arch_hw_breakpoint_ctrl
ctrl;
27 static inline u32 encode_ctrl_reg(
struct arch_hw_breakpoint_ctrl
ctrl)
29 return (ctrl.mismatch << 22) | (ctrl.len << 5) | (ctrl.type << 3) |
30 (ctrl.privilege << 1) | ctrl.enabled;
33 static inline void decode_ctrl_reg(
u32 reg,
34 struct arch_hw_breakpoint_ctrl *ctrl)
36 ctrl->enabled = reg & 0x1;
38 ctrl->privilege = reg & 0x3;
40 ctrl->type = reg & 0x3;
42 ctrl->len = reg & 0xff;
44 ctrl->mismatch = reg & 0x1;
48 #define ARM_DEBUG_ARCH_RESERVED 0
49 #define ARM_DEBUG_ARCH_V6 1
50 #define ARM_DEBUG_ARCH_V6_1 2
51 #define ARM_DEBUG_ARCH_V7_ECP14 3
52 #define ARM_DEBUG_ARCH_V7_MM 4
53 #define ARM_DEBUG_ARCH_V7_1 5
56 #define ARM_BREAKPOINT_EXECUTE 0
59 #define ARM_BREAKPOINT_LOAD 1
60 #define ARM_BREAKPOINT_STORE 2
61 #define ARM_FSR_ACCESS_MASK (1 << 11)
64 #define ARM_BREAKPOINT_PRIV 1
65 #define ARM_BREAKPOINT_USER 2
68 #define ARM_BREAKPOINT_LEN_1 0x1
69 #define ARM_BREAKPOINT_LEN_2 0x3
70 #define ARM_BREAKPOINT_LEN_4 0xf
71 #define ARM_BREAKPOINT_LEN_8 0xff
74 #define ARM_MAX_BRP 16
75 #define ARM_MAX_WRP 16
76 #define ARM_MAX_HBP_SLOTS (ARM_MAX_BRP + ARM_MAX_WRP)
79 #define ARM_DSCR_MOE(x) ((x >> 2) & 0xf)
80 #define ARM_ENTRY_BREAKPOINT 0x1
81 #define ARM_ENTRY_ASYNC_WATCHPOINT 0x2
82 #define ARM_ENTRY_SYNC_WATCHPOINT 0xa
85 #define ARM_DSCR_HDBGEN (1 << 14)
86 #define ARM_DSCR_MDBGEN (1 << 15)
95 #define ARM_BASE_BVR 64
96 #define ARM_BASE_BCR 80
97 #define ARM_BASE_WVR 96
98 #define ARM_BASE_WCR 112
101 #define ARM_DBG_READ(M, OP2, VAL) do {\
102 asm volatile("mrc p14, 0, %0, c0," #M ", " #OP2 : "=r" (VAL));\
105 #define ARM_DBG_WRITE(M, OP2, VAL) do {\
106 asm volatile("mcr p14, 0, %0, c0," #M ", " #OP2 : : "r" (VAL));\
115 int *gen_len,
int *gen_type);
119 unsigned long val,
void *
data);
123 extern void clear_ptrace_hw_breakpoint(
struct task_struct *tsk);
131 static inline void clear_ptrace_hw_breakpoint(
struct task_struct *tsk) {}