25 #include <linux/ptrace.h>
26 #include <linux/stat.h>
29 #include <asm/local.h>
30 #include <asm/cputype.h>
31 #include <asm/system_misc.h>
34 #define DBG_MDSCR_SS (1 << 0)
35 #define DBG_SPSR_SS (1 << 21)
38 #define DBG_MDSCR_KDE (1 << 13)
39 #define DBG_MDSCR_MDE (1 << 15)
40 #define DBG_MDSCR_MASK ~(DBG_MDSCR_KDE | DBG_MDSCR_MDE)
51 static void mdscr_write(
u32 mdscr)
54 local_dbg_save(flags);
55 asm volatile(
"msr mdscr_el1, %0" ::
"r" (mdscr));
56 local_dbg_restore(flags);
59 static u32 mdscr_read(
void)
62 asm volatile(
"mrs %0, mdscr_el1" :
"=r" (mdscr));
72 static int create_debug_debugfs_entry(
void)
79 static int __init early_debug_disable(
char *
buf)
103 if (el == DBG_ACTIVE_EL1 &&
108 mdscr = mdscr_read();
123 if (el == DBG_ACTIVE_EL1 &&
128 mdscr = mdscr_read();
137 static void clear_os_lock(
void *
unused)
139 asm volatile(
"msr mdscr_el1, %0" : :
"r" (0));
141 asm volatile(
"msr oslar_el1, %0" : :
"r" (0));
155 .notifier_call = os_lock_notify,
158 static int __cpuinit debug_monitors_init(
void)
165 register_cpu_notifier(&os_lock_nb);
183 static void clear_regs_spsr_ss(
struct pt_regs *
regs)
192 static int single_step_handler(
unsigned long addr,
unsigned int esr,
220 pr_warning(
"Unexpected kernel single-step exception at EL1\n");
225 set_regs_spsr_ss(regs);
231 static int __init single_step_init(
void)
260 set_regs_spsr_ss(regs);