Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify it |
| 3 | * under the terms of the GNU General Public License as published by the |
| 4 | * Free Software Foundation; either version 2, or (at your option) any |
| 5 | * later version. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, but |
| 8 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 10 | * General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | /* |
| 15 | * Copyright (C) 2004 Amit S. Kale <amitkale@linsyssoft.com> |
| 16 | * Copyright (C) 2000-2001 VERITAS Software Corporation. |
| 17 | * Copyright (C) 2002 Andi Kleen, SuSE Labs |
| 18 | * Copyright (C) 2004 LinSysSoft Technologies Pvt. Ltd. |
| 19 | * Copyright (C) 2007 MontaVista Software, Inc. |
| 20 | * Copyright (C) 2007-2008 Jason Wessel, Wind River Systems, Inc. |
| 21 | */ |
| 22 | /**************************************************************************** |
| 23 | * Contributor: Lake Stevens Instrument Division$ |
| 24 | * Written by: Glenn Engel $ |
| 25 | * Updated by: Amit Kale<akale@veritas.com> |
| 26 | * Updated by: Tom Rini <trini@kernel.crashing.org> |
| 27 | * Updated by: Jason Wessel <jason.wessel@windriver.com> |
| 28 | * Modified for 386 by Jim Kingdon, Cygnus Support. |
| 29 | * Origianl kgdb, compatibility with 2.1.xx kernel by |
| 30 | * David Grothe <dave@gcom.com> |
| 31 | * Integrated into 2.2.5 kernel by Tigran Aivazian <tigran@sco.com> |
| 32 | * X86_64 changes from Andi Kleen's patch merged by Jim Houston |
| 33 | */ |
| 34 | #include <linux/spinlock.h> |
| 35 | #include <linux/kdebug.h> |
| 36 | #include <linux/string.h> |
| 37 | #include <linux/kernel.h> |
| 38 | #include <linux/ptrace.h> |
| 39 | #include <linux/sched.h> |
| 40 | #include <linux/delay.h> |
| 41 | #include <linux/kgdb.h> |
| 42 | #include <linux/init.h> |
| 43 | #include <linux/smp.h> |
Jason Wessel | d359752 | 2008-02-15 14:55:53 -0600 | [diff] [blame] | 44 | #include <linux/nmi.h> |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 45 | #include <linux/hw_breakpoint.h> |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 46 | |
K.Prasad | 62edab9 | 2009-06-01 23:47:06 +0530 | [diff] [blame] | 47 | #include <asm/debugreg.h> |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 48 | #include <asm/apicdef.h> |
| 49 | #include <asm/system.h> |
Ingo Molnar | 7b6aa33 | 2009-02-17 13:58:15 +0100 | [diff] [blame] | 50 | #include <asm/apic.h> |
Don Zickus | 166d751 | 2011-01-06 16:18:49 -0500 | [diff] [blame] | 51 | #include <asm/nmi.h> |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 52 | |
Jason Wessel | 12bfa3d | 2010-08-05 09:22:20 -0500 | [diff] [blame] | 53 | struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 54 | { |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 55 | #ifdef CONFIG_X86_32 |
Jason Wessel | 12bfa3d | 2010-08-05 09:22:20 -0500 | [diff] [blame] | 56 | { "ax", 4, offsetof(struct pt_regs, ax) }, |
| 57 | { "cx", 4, offsetof(struct pt_regs, cx) }, |
| 58 | { "dx", 4, offsetof(struct pt_regs, dx) }, |
| 59 | { "bx", 4, offsetof(struct pt_regs, bx) }, |
| 60 | { "sp", 4, offsetof(struct pt_regs, sp) }, |
| 61 | { "bp", 4, offsetof(struct pt_regs, bp) }, |
| 62 | { "si", 4, offsetof(struct pt_regs, si) }, |
| 63 | { "di", 4, offsetof(struct pt_regs, di) }, |
| 64 | { "ip", 4, offsetof(struct pt_regs, ip) }, |
| 65 | { "flags", 4, offsetof(struct pt_regs, flags) }, |
| 66 | { "cs", 4, offsetof(struct pt_regs, cs) }, |
| 67 | { "ss", 4, offsetof(struct pt_regs, ss) }, |
| 68 | { "ds", 4, offsetof(struct pt_regs, ds) }, |
| 69 | { "es", 4, offsetof(struct pt_regs, es) }, |
| 70 | { "fs", 4, -1 }, |
| 71 | { "gs", 4, -1 }, |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 72 | #else |
Jason Wessel | 12bfa3d | 2010-08-05 09:22:20 -0500 | [diff] [blame] | 73 | { "ax", 8, offsetof(struct pt_regs, ax) }, |
| 74 | { "bx", 8, offsetof(struct pt_regs, bx) }, |
| 75 | { "cx", 8, offsetof(struct pt_regs, cx) }, |
| 76 | { "dx", 8, offsetof(struct pt_regs, dx) }, |
| 77 | { "si", 8, offsetof(struct pt_regs, dx) }, |
| 78 | { "di", 8, offsetof(struct pt_regs, di) }, |
| 79 | { "bp", 8, offsetof(struct pt_regs, bp) }, |
| 80 | { "sp", 8, offsetof(struct pt_regs, sp) }, |
| 81 | { "r8", 8, offsetof(struct pt_regs, r8) }, |
| 82 | { "r9", 8, offsetof(struct pt_regs, r9) }, |
| 83 | { "r10", 8, offsetof(struct pt_regs, r10) }, |
| 84 | { "r11", 8, offsetof(struct pt_regs, r11) }, |
| 85 | { "r12", 8, offsetof(struct pt_regs, r12) }, |
| 86 | { "r13", 8, offsetof(struct pt_regs, r13) }, |
| 87 | { "r14", 8, offsetof(struct pt_regs, r14) }, |
| 88 | { "r15", 8, offsetof(struct pt_regs, r15) }, |
| 89 | { "ip", 8, offsetof(struct pt_regs, ip) }, |
| 90 | { "flags", 4, offsetof(struct pt_regs, flags) }, |
| 91 | { "cs", 4, offsetof(struct pt_regs, cs) }, |
| 92 | { "ss", 4, offsetof(struct pt_regs, ss) }, |
Jason Wessel | cf6f196 | 2009-12-11 08:43:16 -0600 | [diff] [blame] | 93 | #endif |
Jason Wessel | 12bfa3d | 2010-08-05 09:22:20 -0500 | [diff] [blame] | 94 | }; |
| 95 | |
| 96 | int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) |
| 97 | { |
| 98 | if ( |
| 99 | #ifdef CONFIG_X86_32 |
| 100 | regno == GDB_SS || regno == GDB_FS || regno == GDB_GS || |
| 101 | #endif |
| 102 | regno == GDB_SP || regno == GDB_ORIG_AX) |
| 103 | return 0; |
| 104 | |
| 105 | if (dbg_reg_def[regno].offset != -1) |
| 106 | memcpy((void *)regs + dbg_reg_def[regno].offset, mem, |
| 107 | dbg_reg_def[regno].size); |
| 108 | return 0; |
| 109 | } |
| 110 | |
| 111 | char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs) |
| 112 | { |
| 113 | if (regno == GDB_ORIG_AX) { |
| 114 | memcpy(mem, ®s->orig_ax, sizeof(regs->orig_ax)); |
| 115 | return "orig_ax"; |
| 116 | } |
| 117 | if (regno >= DBG_MAX_REG_NUM || regno < 0) |
| 118 | return NULL; |
| 119 | |
| 120 | if (dbg_reg_def[regno].offset != -1) |
| 121 | memcpy(mem, (void *)regs + dbg_reg_def[regno].offset, |
| 122 | dbg_reg_def[regno].size); |
| 123 | |
Jason Wessel | 12bfa3d | 2010-08-05 09:22:20 -0500 | [diff] [blame] | 124 | #ifdef CONFIG_X86_32 |
Jason Wessel | 21431c2 | 2010-03-15 07:28:00 -0500 | [diff] [blame] | 125 | switch (regno) { |
Jason Wessel | 12bfa3d | 2010-08-05 09:22:20 -0500 | [diff] [blame] | 126 | case GDB_SS: |
| 127 | if (!user_mode_vm(regs)) |
| 128 | *(unsigned long *)mem = __KERNEL_DS; |
| 129 | break; |
| 130 | case GDB_SP: |
| 131 | if (!user_mode_vm(regs)) |
| 132 | *(unsigned long *)mem = kernel_stack_pointer(regs); |
| 133 | break; |
| 134 | case GDB_GS: |
| 135 | case GDB_FS: |
| 136 | *(unsigned long *)mem = 0xFFFF; |
| 137 | break; |
Jason Wessel | 12bfa3d | 2010-08-05 09:22:20 -0500 | [diff] [blame] | 138 | } |
Jason Wessel | 21431c2 | 2010-03-15 07:28:00 -0500 | [diff] [blame] | 139 | #endif |
Jason Wessel | 12bfa3d | 2010-08-05 09:22:20 -0500 | [diff] [blame] | 140 | return dbg_reg_def[regno].name; |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | /** |
| 144 | * sleeping_thread_to_gdb_regs - Convert ptrace regs to GDB regs |
| 145 | * @gdb_regs: A pointer to hold the registers in the order GDB wants. |
| 146 | * @p: The &struct task_struct of the desired process. |
| 147 | * |
| 148 | * Convert the register values of the sleeping process in @p to |
| 149 | * the format that GDB expects. |
| 150 | * This function is called when kgdb does not have access to the |
| 151 | * &struct pt_regs and therefore it should fill the gdb registers |
| 152 | * @gdb_regs with what has been saved in &struct thread_struct |
| 153 | * thread field during switch_to. |
| 154 | */ |
| 155 | void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) |
| 156 | { |
Jason Wessel | 703a1ed | 2008-09-26 10:36:42 -0500 | [diff] [blame] | 157 | #ifndef CONFIG_X86_32 |
| 158 | u32 *gdb_regs32 = (u32 *)gdb_regs; |
| 159 | #endif |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 160 | gdb_regs[GDB_AX] = 0; |
| 161 | gdb_regs[GDB_BX] = 0; |
| 162 | gdb_regs[GDB_CX] = 0; |
| 163 | gdb_regs[GDB_DX] = 0; |
| 164 | gdb_regs[GDB_SI] = 0; |
| 165 | gdb_regs[GDB_DI] = 0; |
| 166 | gdb_regs[GDB_BP] = *(unsigned long *)p->thread.sp; |
| 167 | #ifdef CONFIG_X86_32 |
| 168 | gdb_regs[GDB_DS] = __KERNEL_DS; |
| 169 | gdb_regs[GDB_ES] = __KERNEL_DS; |
| 170 | gdb_regs[GDB_PS] = 0; |
| 171 | gdb_regs[GDB_CS] = __KERNEL_CS; |
| 172 | gdb_regs[GDB_PC] = p->thread.ip; |
| 173 | gdb_regs[GDB_SS] = __KERNEL_DS; |
| 174 | gdb_regs[GDB_FS] = 0xFFFF; |
| 175 | gdb_regs[GDB_GS] = 0xFFFF; |
| 176 | #else |
Jason Wessel | 703a1ed | 2008-09-26 10:36:42 -0500 | [diff] [blame] | 177 | gdb_regs32[GDB_PS] = *(unsigned long *)(p->thread.sp + 8); |
| 178 | gdb_regs32[GDB_CS] = __KERNEL_CS; |
| 179 | gdb_regs32[GDB_SS] = __KERNEL_DS; |
Alexey Dobriyan | 0c23590 | 2009-05-04 03:30:15 +0400 | [diff] [blame] | 180 | gdb_regs[GDB_PC] = 0; |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 181 | gdb_regs[GDB_R8] = 0; |
| 182 | gdb_regs[GDB_R9] = 0; |
| 183 | gdb_regs[GDB_R10] = 0; |
| 184 | gdb_regs[GDB_R11] = 0; |
| 185 | gdb_regs[GDB_R12] = 0; |
| 186 | gdb_regs[GDB_R13] = 0; |
| 187 | gdb_regs[GDB_R14] = 0; |
| 188 | gdb_regs[GDB_R15] = 0; |
| 189 | #endif |
| 190 | gdb_regs[GDB_SP] = p->thread.sp; |
| 191 | } |
| 192 | |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 193 | static struct hw_breakpoint { |
| 194 | unsigned enabled; |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 195 | unsigned long addr; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 196 | int len; |
| 197 | int type; |
Namhyung Kim | 8c8aefc | 2010-08-07 11:00:59 -0700 | [diff] [blame] | 198 | struct perf_event * __percpu *pev; |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 199 | } breakinfo[HBP_NUM]; |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 200 | |
Jason Wessel | 031acd8 | 2010-05-20 21:04:30 -0500 | [diff] [blame] | 201 | static unsigned long early_dr7; |
| 202 | |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 203 | static void kgdb_correct_hw_break(void) |
| 204 | { |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 205 | int breakno; |
| 206 | |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 207 | for (breakno = 0; breakno < HBP_NUM; breakno++) { |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 208 | struct perf_event *bp; |
| 209 | struct arch_hw_breakpoint *info; |
| 210 | int val; |
| 211 | int cpu = raw_smp_processor_id(); |
| 212 | if (!breakinfo[breakno].enabled) |
| 213 | continue; |
Jason Wessel | 031acd8 | 2010-05-20 21:04:30 -0500 | [diff] [blame] | 214 | if (dbg_is_early) { |
| 215 | set_debugreg(breakinfo[breakno].addr, breakno); |
| 216 | early_dr7 |= encode_dr7(breakno, |
| 217 | breakinfo[breakno].len, |
| 218 | breakinfo[breakno].type); |
| 219 | set_debugreg(early_dr7, 7); |
| 220 | continue; |
| 221 | } |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 222 | bp = *per_cpu_ptr(breakinfo[breakno].pev, cpu); |
| 223 | info = counter_arch_bp(bp); |
| 224 | if (bp->attr.disabled != 1) |
| 225 | continue; |
| 226 | bp->attr.bp_addr = breakinfo[breakno].addr; |
| 227 | bp->attr.bp_len = breakinfo[breakno].len; |
| 228 | bp->attr.bp_type = breakinfo[breakno].type; |
| 229 | info->address = breakinfo[breakno].addr; |
| 230 | info->len = breakinfo[breakno].len; |
| 231 | info->type = breakinfo[breakno].type; |
| 232 | val = arch_install_hw_breakpoint(bp); |
| 233 | if (!val) |
| 234 | bp->attr.disabled = 0; |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 235 | } |
Jason Wessel | 031acd8 | 2010-05-20 21:04:30 -0500 | [diff] [blame] | 236 | if (!dbg_is_early) |
| 237 | hw_breakpoint_restore(); |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 238 | } |
| 239 | |
Jason Wessel | 5352ae6 | 2010-01-28 17:04:43 -0600 | [diff] [blame] | 240 | static int hw_break_reserve_slot(int breakno) |
| 241 | { |
| 242 | int cpu; |
| 243 | int cnt = 0; |
| 244 | struct perf_event **pevent; |
| 245 | |
Jason Wessel | 031acd8 | 2010-05-20 21:04:30 -0500 | [diff] [blame] | 246 | if (dbg_is_early) |
| 247 | return 0; |
| 248 | |
Jason Wessel | 5352ae6 | 2010-01-28 17:04:43 -0600 | [diff] [blame] | 249 | for_each_online_cpu(cpu) { |
| 250 | cnt++; |
| 251 | pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu); |
| 252 | if (dbg_reserve_bp_slot(*pevent)) |
| 253 | goto fail; |
| 254 | } |
| 255 | |
| 256 | return 0; |
| 257 | |
| 258 | fail: |
| 259 | for_each_online_cpu(cpu) { |
| 260 | cnt--; |
| 261 | if (!cnt) |
| 262 | break; |
| 263 | pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu); |
| 264 | dbg_release_bp_slot(*pevent); |
| 265 | } |
| 266 | return -1; |
| 267 | } |
| 268 | |
| 269 | static int hw_break_release_slot(int breakno) |
| 270 | { |
| 271 | struct perf_event **pevent; |
| 272 | int cpu; |
| 273 | |
Jason Wessel | 031acd8 | 2010-05-20 21:04:30 -0500 | [diff] [blame] | 274 | if (dbg_is_early) |
| 275 | return 0; |
| 276 | |
Jason Wessel | 5352ae6 | 2010-01-28 17:04:43 -0600 | [diff] [blame] | 277 | for_each_online_cpu(cpu) { |
| 278 | pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu); |
| 279 | if (dbg_release_bp_slot(*pevent)) |
| 280 | /* |
Lucas De Marchi | 0d2eb44 | 2011-03-17 16:24:16 -0300 | [diff] [blame] | 281 | * The debugger is responsible for handing the retry on |
Jason Wessel | 5352ae6 | 2010-01-28 17:04:43 -0600 | [diff] [blame] | 282 | * remove failure. |
| 283 | */ |
| 284 | return -1; |
| 285 | } |
| 286 | return 0; |
| 287 | } |
| 288 | |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 289 | static int |
| 290 | kgdb_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype) |
| 291 | { |
| 292 | int i; |
| 293 | |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 294 | for (i = 0; i < HBP_NUM; i++) |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 295 | if (breakinfo[i].addr == addr && breakinfo[i].enabled) |
| 296 | break; |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 297 | if (i == HBP_NUM) |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 298 | return -1; |
| 299 | |
Jason Wessel | 5352ae6 | 2010-01-28 17:04:43 -0600 | [diff] [blame] | 300 | if (hw_break_release_slot(i)) { |
| 301 | printk(KERN_ERR "Cannot remove hw breakpoint at %lx\n", addr); |
| 302 | return -1; |
| 303 | } |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 304 | breakinfo[i].enabled = 0; |
| 305 | |
| 306 | return 0; |
| 307 | } |
| 308 | |
| 309 | static void kgdb_remove_all_hw_break(void) |
| 310 | { |
| 311 | int i; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 312 | int cpu = raw_smp_processor_id(); |
| 313 | struct perf_event *bp; |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 314 | |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 315 | for (i = 0; i < HBP_NUM; i++) { |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 316 | if (!breakinfo[i].enabled) |
| 317 | continue; |
| 318 | bp = *per_cpu_ptr(breakinfo[i].pev, cpu); |
Jason Wessel | 10a6e67 | 2010-11-15 08:07:35 -0600 | [diff] [blame] | 319 | if (!bp->attr.disabled) { |
| 320 | arch_uninstall_hw_breakpoint(bp); |
| 321 | bp->attr.disabled = 1; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 322 | continue; |
Jason Wessel | 10a6e67 | 2010-11-15 08:07:35 -0600 | [diff] [blame] | 323 | } |
Jason Wessel | 031acd8 | 2010-05-20 21:04:30 -0500 | [diff] [blame] | 324 | if (dbg_is_early) |
| 325 | early_dr7 &= ~encode_dr7(i, breakinfo[i].len, |
| 326 | breakinfo[i].type); |
Jason Wessel | 10a6e67 | 2010-11-15 08:07:35 -0600 | [diff] [blame] | 327 | else if (hw_break_release_slot(i)) |
| 328 | printk(KERN_ERR "KGDB: hw bpt remove failed %lx\n", |
| 329 | breakinfo[i].addr); |
| 330 | breakinfo[i].enabled = 0; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 331 | } |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | static int |
| 335 | kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype) |
| 336 | { |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 337 | int i; |
| 338 | |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 339 | for (i = 0; i < HBP_NUM; i++) |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 340 | if (!breakinfo[i].enabled) |
| 341 | break; |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 342 | if (i == HBP_NUM) |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 343 | return -1; |
| 344 | |
| 345 | switch (bptype) { |
| 346 | case BP_HARDWARE_BREAKPOINT: |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 347 | len = 1; |
| 348 | breakinfo[i].type = X86_BREAKPOINT_EXECUTE; |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 349 | break; |
| 350 | case BP_WRITE_WATCHPOINT: |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 351 | breakinfo[i].type = X86_BREAKPOINT_WRITE; |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 352 | break; |
| 353 | case BP_ACCESS_WATCHPOINT: |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 354 | breakinfo[i].type = X86_BREAKPOINT_RW; |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 355 | break; |
| 356 | default: |
| 357 | return -1; |
| 358 | } |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 359 | switch (len) { |
| 360 | case 1: |
| 361 | breakinfo[i].len = X86_BREAKPOINT_LEN_1; |
| 362 | break; |
| 363 | case 2: |
| 364 | breakinfo[i].len = X86_BREAKPOINT_LEN_2; |
| 365 | break; |
| 366 | case 4: |
| 367 | breakinfo[i].len = X86_BREAKPOINT_LEN_4; |
| 368 | break; |
| 369 | #ifdef CONFIG_X86_64 |
| 370 | case 8: |
| 371 | breakinfo[i].len = X86_BREAKPOINT_LEN_8; |
| 372 | break; |
| 373 | #endif |
| 374 | default: |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 375 | return -1; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 376 | } |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 377 | breakinfo[i].addr = addr; |
Jason Wessel | 5352ae6 | 2010-01-28 17:04:43 -0600 | [diff] [blame] | 378 | if (hw_break_reserve_slot(i)) { |
| 379 | breakinfo[i].addr = 0; |
| 380 | return -1; |
| 381 | } |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 382 | breakinfo[i].enabled = 1; |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 383 | |
| 384 | return 0; |
| 385 | } |
| 386 | |
| 387 | /** |
| 388 | * kgdb_disable_hw_debug - Disable hardware debugging while we in kgdb. |
| 389 | * @regs: Current &struct pt_regs. |
| 390 | * |
| 391 | * This function will be called if the particular architecture must |
| 392 | * disable hardware debugging while it is processing gdb packets or |
| 393 | * handling exception. |
| 394 | */ |
Dongdong Deng | d7ba979d | 2010-08-18 06:02:00 -0500 | [diff] [blame] | 395 | static void kgdb_disable_hw_debug(struct pt_regs *regs) |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 396 | { |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 397 | int i; |
| 398 | int cpu = raw_smp_processor_id(); |
| 399 | struct perf_event *bp; |
| 400 | |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 401 | /* Disable hardware debugging while we are in kgdb: */ |
| 402 | set_debugreg(0UL, 7); |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 403 | for (i = 0; i < HBP_NUM; i++) { |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 404 | if (!breakinfo[i].enabled) |
| 405 | continue; |
Jason Wessel | 031acd8 | 2010-05-20 21:04:30 -0500 | [diff] [blame] | 406 | if (dbg_is_early) { |
| 407 | early_dr7 &= ~encode_dr7(i, breakinfo[i].len, |
| 408 | breakinfo[i].type); |
| 409 | continue; |
| 410 | } |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 411 | bp = *per_cpu_ptr(breakinfo[i].pev, cpu); |
| 412 | if (bp->attr.disabled == 1) |
| 413 | continue; |
| 414 | arch_uninstall_hw_breakpoint(bp); |
| 415 | bp->attr.disabled = 1; |
| 416 | } |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 417 | } |
| 418 | |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 419 | #ifdef CONFIG_SMP |
| 420 | /** |
| 421 | * kgdb_roundup_cpus - Get other CPUs into a holding pattern |
| 422 | * @flags: Current IRQ state |
| 423 | * |
| 424 | * On SMP systems, we need to get the attention of the other CPUs |
| 425 | * and get them be in a known state. This should do what is needed |
| 426 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, |
| 427 | * the NMI approach is not used for rounding up all the CPUs. For example, |
| 428 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In |
| 429 | * this case, we have to make sure that interrupts are enabled before |
| 430 | * calling smp_call_function(). The argument to this function is |
| 431 | * the flags that will be used when restoring the interrupts. There is |
| 432 | * local_irq_save() call before kgdb_roundup_cpus(). |
| 433 | * |
| 434 | * On non-SMP systems, this is not called. |
| 435 | */ |
| 436 | void kgdb_roundup_cpus(unsigned long flags) |
| 437 | { |
Ingo Molnar | dac5f41 | 2009-01-28 15:42:24 +0100 | [diff] [blame] | 438 | apic->send_IPI_allbutself(APIC_DM_NMI); |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 439 | } |
| 440 | #endif |
| 441 | |
| 442 | /** |
| 443 | * kgdb_arch_handle_exception - Handle architecture specific GDB packets. |
| 444 | * @vector: The error vector of the exception that happened. |
| 445 | * @signo: The signal number of the exception that happened. |
| 446 | * @err_code: The error code of the exception that happened. |
| 447 | * @remcom_in_buffer: The buffer of the packet we have read. |
| 448 | * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into. |
| 449 | * @regs: The &struct pt_regs of the current process. |
| 450 | * |
| 451 | * This function MUST handle the 'c' and 's' command packets, |
| 452 | * as well packets to set / remove a hardware breakpoint, if used. |
| 453 | * If there are additional packets which the hardware needs to handle, |
| 454 | * they are handled here. The code should return -1 if it wants to |
| 455 | * process more packets, and a %0 or %1 if it wants to exit from the |
| 456 | * kgdb callback. |
| 457 | */ |
| 458 | int kgdb_arch_handle_exception(int e_vector, int signo, int err_code, |
| 459 | char *remcomInBuffer, char *remcomOutBuffer, |
| 460 | struct pt_regs *linux_regs) |
| 461 | { |
| 462 | unsigned long addr; |
| 463 | char *ptr; |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 464 | |
| 465 | switch (remcomInBuffer[0]) { |
| 466 | case 'c': |
| 467 | case 's': |
| 468 | /* try to read optional parameter, pc unchanged if no parm */ |
| 469 | ptr = &remcomInBuffer[1]; |
| 470 | if (kgdb_hex2long(&ptr, &addr)) |
| 471 | linux_regs->ip = addr; |
Jason Wessel | 737a460 | 2008-03-07 16:34:16 -0600 | [diff] [blame] | 472 | case 'D': |
| 473 | case 'k': |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 474 | /* clear the trace bit */ |
Harvey Harrison | fda31d7 | 2008-04-18 09:54:38 -0700 | [diff] [blame] | 475 | linux_regs->flags &= ~X86_EFLAGS_TF; |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 476 | atomic_set(&kgdb_cpu_doing_single_step, -1); |
| 477 | |
| 478 | /* set the trace bit if we're stepping */ |
| 479 | if (remcomInBuffer[0] == 's') { |
Harvey Harrison | fda31d7 | 2008-04-18 09:54:38 -0700 | [diff] [blame] | 480 | linux_regs->flags |= X86_EFLAGS_TF; |
Jason Wessel | d7161a6 | 2008-09-26 10:36:41 -0500 | [diff] [blame] | 481 | atomic_set(&kgdb_cpu_doing_single_step, |
| 482 | raw_smp_processor_id()); |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 483 | } |
| 484 | |
| 485 | return 0; |
| 486 | } |
| 487 | |
| 488 | /* this means that we do not want to exit from the handler: */ |
| 489 | return -1; |
| 490 | } |
| 491 | |
| 492 | static inline int |
| 493 | single_step_cont(struct pt_regs *regs, struct die_args *args) |
| 494 | { |
| 495 | /* |
| 496 | * Single step exception from kernel space to user space so |
| 497 | * eat the exception and continue the process: |
| 498 | */ |
| 499 | printk(KERN_ERR "KGDB: trap/step from kernel to user space, " |
| 500 | "resuming...\n"); |
| 501 | kgdb_arch_handle_exception(args->trapnr, args->signr, |
| 502 | args->err, "c", "", regs); |
K.Prasad | 62edab9 | 2009-06-01 23:47:06 +0530 | [diff] [blame] | 503 | /* |
| 504 | * Reset the BS bit in dr6 (pointed by args->err) to |
| 505 | * denote completion of processing |
| 506 | */ |
| 507 | (*(unsigned long *)ERR_PTR(args->err)) &= ~DR_STEP; |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 508 | |
| 509 | return NOTIFY_STOP; |
| 510 | } |
| 511 | |
Jason Wessel | d359752 | 2008-02-15 14:55:53 -0600 | [diff] [blame] | 512 | static int was_in_debug_nmi[NR_CPUS]; |
| 513 | |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 514 | static int __kgdb_notify(struct die_args *args, unsigned long cmd) |
| 515 | { |
| 516 | struct pt_regs *regs = args->regs; |
| 517 | |
| 518 | switch (cmd) { |
| 519 | case DIE_NMI: |
| 520 | if (atomic_read(&kgdb_active) != -1) { |
| 521 | /* KGDB CPU roundup */ |
| 522 | kgdb_nmicallback(raw_smp_processor_id(), regs); |
Jason Wessel | d359752 | 2008-02-15 14:55:53 -0600 | [diff] [blame] | 523 | was_in_debug_nmi[raw_smp_processor_id()] = 1; |
| 524 | touch_nmi_watchdog(); |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 525 | return NOTIFY_STOP; |
| 526 | } |
| 527 | return NOTIFY_DONE; |
| 528 | |
Jason Wessel | d359752 | 2008-02-15 14:55:53 -0600 | [diff] [blame] | 529 | case DIE_NMIUNKNOWN: |
| 530 | if (was_in_debug_nmi[raw_smp_processor_id()]) { |
| 531 | was_in_debug_nmi[raw_smp_processor_id()] = 0; |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 532 | return NOTIFY_STOP; |
| 533 | } |
| 534 | return NOTIFY_DONE; |
| 535 | |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 536 | case DIE_DEBUG: |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 537 | if (atomic_read(&kgdb_cpu_doing_single_step) != -1) { |
Jason Wessel | d7161a6 | 2008-09-26 10:36:41 -0500 | [diff] [blame] | 538 | if (user_mode(regs)) |
| 539 | return single_step_cont(regs, args); |
| 540 | break; |
| 541 | } else if (test_thread_flag(TIF_SINGLESTEP)) |
| 542 | /* This means a user thread is single stepping |
| 543 | * a system call which should be ignored |
| 544 | */ |
| 545 | return NOTIFY_DONE; |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 546 | /* fall through */ |
| 547 | default: |
| 548 | if (user_mode(regs)) |
| 549 | return NOTIFY_DONE; |
| 550 | } |
| 551 | |
Jason Wessel | f503b5a | 2010-05-20 21:04:25 -0500 | [diff] [blame] | 552 | if (kgdb_handle_exception(args->trapnr, args->signr, cmd, regs)) |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 553 | return NOTIFY_DONE; |
| 554 | |
Jason Wessel | 737a460 | 2008-03-07 16:34:16 -0600 | [diff] [blame] | 555 | /* Must touch watchdog before return to normal operation */ |
| 556 | touch_nmi_watchdog(); |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 557 | return NOTIFY_STOP; |
| 558 | } |
| 559 | |
Jason Wessel | f503b5a | 2010-05-20 21:04:25 -0500 | [diff] [blame] | 560 | int kgdb_ll_trap(int cmd, const char *str, |
| 561 | struct pt_regs *regs, long err, int trap, int sig) |
| 562 | { |
| 563 | struct die_args args = { |
| 564 | .regs = regs, |
| 565 | .str = str, |
| 566 | .err = err, |
| 567 | .trapnr = trap, |
| 568 | .signr = sig, |
| 569 | |
| 570 | }; |
| 571 | |
| 572 | if (!kgdb_io_module_registered) |
| 573 | return NOTIFY_DONE; |
| 574 | |
| 575 | return __kgdb_notify(&args, cmd); |
| 576 | } |
Jason Wessel | f503b5a | 2010-05-20 21:04:25 -0500 | [diff] [blame] | 577 | |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 578 | static int |
| 579 | kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr) |
| 580 | { |
| 581 | unsigned long flags; |
| 582 | int ret; |
| 583 | |
| 584 | local_irq_save(flags); |
| 585 | ret = __kgdb_notify(ptr, cmd); |
| 586 | local_irq_restore(flags); |
| 587 | |
| 588 | return ret; |
| 589 | } |
| 590 | |
| 591 | static struct notifier_block kgdb_notifier = { |
| 592 | .notifier_call = kgdb_notify, |
| 593 | |
| 594 | /* |
| 595 | * Lowest-prio notifier priority, we want to be notified last: |
| 596 | */ |
Don Zickus | 166d751 | 2011-01-06 16:18:49 -0500 | [diff] [blame] | 597 | .priority = NMI_LOCAL_LOW_PRIOR, |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 598 | }; |
| 599 | |
| 600 | /** |
| 601 | * kgdb_arch_init - Perform any architecture specific initalization. |
| 602 | * |
| 603 | * This function will handle the initalization of any architecture |
| 604 | * specific callbacks. |
| 605 | */ |
| 606 | int kgdb_arch_init(void) |
| 607 | { |
Jason Wessel | 0b4b382 | 2010-05-20 21:04:29 -0500 | [diff] [blame] | 608 | return register_die_notifier(&kgdb_notifier); |
| 609 | } |
| 610 | |
Peter Zijlstra | a8b0ca1 | 2011-06-27 14:41:57 +0200 | [diff] [blame^] | 611 | static void kgdb_hw_overflow_handler(struct perf_event *event, |
Jason Wessel | ba773f7 | 2010-07-28 19:10:30 -0500 | [diff] [blame] | 612 | struct perf_sample_data *data, struct pt_regs *regs) |
| 613 | { |
Jason Wessel | fad99fa | 2010-10-20 08:20:00 -0500 | [diff] [blame] | 614 | struct task_struct *tsk = current; |
| 615 | int i; |
| 616 | |
| 617 | for (i = 0; i < 4; i++) |
| 618 | if (breakinfo[i].enabled) |
| 619 | tsk->thread.debugreg6 |= (DR_TRAP0 << i); |
Jason Wessel | ba773f7 | 2010-07-28 19:10:30 -0500 | [diff] [blame] | 620 | } |
| 621 | |
Jason Wessel | 0b4b382 | 2010-05-20 21:04:29 -0500 | [diff] [blame] | 622 | void kgdb_arch_late(void) |
| 623 | { |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 624 | int i, cpu; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 625 | struct perf_event_attr attr; |
| 626 | struct perf_event **pevent; |
| 627 | |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 628 | /* |
| 629 | * Pre-allocate the hw breakpoint structions in the non-atomic |
| 630 | * portion of kgdb because this operation requires mutexs to |
| 631 | * complete. |
| 632 | */ |
Jason Wessel | ab310b5 | 2010-03-30 14:05:07 -0500 | [diff] [blame] | 633 | hw_breakpoint_init(&attr); |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 634 | attr.bp_addr = (unsigned long)kgdb_arch_init; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 635 | attr.bp_len = HW_BREAKPOINT_LEN_1; |
| 636 | attr.bp_type = HW_BREAKPOINT_W; |
| 637 | attr.disabled = 1; |
Dongdong Deng | df49393 | 2010-08-05 09:22:25 -0500 | [diff] [blame] | 638 | for (i = 0; i < HBP_NUM; i++) { |
Jason Wessel | 0b4b382 | 2010-05-20 21:04:29 -0500 | [diff] [blame] | 639 | if (breakinfo[i].pev) |
| 640 | continue; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 641 | breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL); |
Jason Wessel | 91b152a | 2010-08-23 09:20:14 -0500 | [diff] [blame] | 642 | if (IS_ERR((void * __force)breakinfo[i].pev)) { |
Jason Wessel | 0b4b382 | 2010-05-20 21:04:29 -0500 | [diff] [blame] | 643 | printk(KERN_ERR "kgdb: Could not allocate hw" |
| 644 | "breakpoints\nDisabling the kernel debugger\n"); |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 645 | breakinfo[i].pev = NULL; |
| 646 | kgdb_arch_exit(); |
Jason Wessel | 0b4b382 | 2010-05-20 21:04:29 -0500 | [diff] [blame] | 647 | return; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 648 | } |
| 649 | for_each_online_cpu(cpu) { |
| 650 | pevent = per_cpu_ptr(breakinfo[i].pev, cpu); |
| 651 | pevent[0]->hw.sample_period = 1; |
Jason Wessel | ba773f7 | 2010-07-28 19:10:30 -0500 | [diff] [blame] | 652 | pevent[0]->overflow_handler = kgdb_hw_overflow_handler; |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 653 | if (pevent[0]->destroy != NULL) { |
| 654 | pevent[0]->destroy = NULL; |
| 655 | release_bp_slot(*pevent); |
| 656 | } |
| 657 | } |
| 658 | } |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 659 | } |
| 660 | |
| 661 | /** |
| 662 | * kgdb_arch_exit - Perform any architecture specific uninitalization. |
| 663 | * |
| 664 | * This function will handle the uninitalization of any architecture |
| 665 | * specific callbacks, for dynamic registration and unregistration. |
| 666 | */ |
| 667 | void kgdb_arch_exit(void) |
| 668 | { |
Jason Wessel | cc09674 | 2010-01-28 17:04:42 -0600 | [diff] [blame] | 669 | int i; |
| 670 | for (i = 0; i < 4; i++) { |
| 671 | if (breakinfo[i].pev) { |
| 672 | unregister_wide_hw_breakpoint(breakinfo[i].pev); |
| 673 | breakinfo[i].pev = NULL; |
| 674 | } |
| 675 | } |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 676 | unregister_die_notifier(&kgdb_notifier); |
| 677 | } |
| 678 | |
| 679 | /** |
| 680 | * |
| 681 | * kgdb_skipexception - Bail out of KGDB when we've been triggered. |
| 682 | * @exception: Exception vector number |
| 683 | * @regs: Current &struct pt_regs. |
| 684 | * |
| 685 | * On some architectures we need to skip a breakpoint exception when |
| 686 | * it occurs after a breakpoint has been removed. |
| 687 | * |
| 688 | * Skip an int3 exception when it occurs after a breakpoint has been |
| 689 | * removed. Backtrack eip by 1 since the int3 would have caused it to |
| 690 | * increment by 1. |
| 691 | */ |
| 692 | int kgdb_skipexception(int exception, struct pt_regs *regs) |
| 693 | { |
| 694 | if (exception == 3 && kgdb_isremovedbreak(regs->ip - 1)) { |
| 695 | regs->ip -= 1; |
| 696 | return 1; |
| 697 | } |
| 698 | return 0; |
| 699 | } |
| 700 | |
| 701 | unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs) |
| 702 | { |
| 703 | if (exception == 3) |
| 704 | return instruction_pointer(regs) - 1; |
| 705 | return instruction_pointer(regs); |
| 706 | } |
| 707 | |
Jason Wessel | dcc7871 | 2010-05-20 21:04:21 -0500 | [diff] [blame] | 708 | void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip) |
| 709 | { |
| 710 | regs->ip = ip; |
| 711 | } |
| 712 | |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 713 | struct kgdb_arch arch_kgdb_ops = { |
| 714 | /* Breakpoint instruction: */ |
| 715 | .gdb_bpt_instr = { 0xcc }, |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 716 | .flags = KGDB_HW_BREAKPOINT, |
| 717 | .set_hw_breakpoint = kgdb_set_hw_break, |
| 718 | .remove_hw_breakpoint = kgdb_remove_hw_break, |
Dongdong Deng | d7ba979d | 2010-08-18 06:02:00 -0500 | [diff] [blame] | 719 | .disable_hw_break = kgdb_disable_hw_debug, |
Jason Wessel | 64e9ee3 | 2008-02-15 14:55:56 -0600 | [diff] [blame] | 720 | .remove_all_hw_break = kgdb_remove_all_hw_break, |
| 721 | .correct_hw_break = kgdb_correct_hw_break, |
Ingo Molnar | 82da3ff | 2008-04-17 20:05:37 +0200 | [diff] [blame] | 722 | }; |