aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r--arch/powerpc/kernel/process.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 1a1f2ddfb581..50e504c29bb9 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -258,6 +258,7 @@ void do_send_trap(struct pt_regs *regs, unsigned long address,
258{ 258{
259 siginfo_t info; 259 siginfo_t info;
260 260
261 current->thread.trap_nr = signal_code;
261 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 262 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
262 11, SIGSEGV) == NOTIFY_STOP) 263 11, SIGSEGV) == NOTIFY_STOP)
263 return; 264 return;
@@ -275,6 +276,7 @@ void do_dabr(struct pt_regs *regs, unsigned long address,
275{ 276{
276 siginfo_t info; 277 siginfo_t info;
277 278
279 current->thread.trap_nr = TRAP_HWBKPT;
278 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 280 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
279 11, SIGSEGV) == NOTIFY_STOP) 281 11, SIGSEGV) == NOTIFY_STOP)
280 return; 282 return;
@@ -283,7 +285,7 @@ void do_dabr(struct pt_regs *regs, unsigned long address,
283 return; 285 return;
284 286
285 /* Clear the DABR */ 287 /* Clear the DABR */
286 set_dabr(0); 288 set_dabr(0, 0);
287 289
288 /* Deliver the signal to userspace */ 290 /* Deliver the signal to userspace */
289 info.si_signo = SIGTRAP; 291 info.si_signo = SIGTRAP;
@@ -364,18 +366,19 @@ static void set_debug_reg_defaults(struct thread_struct *thread)
364{ 366{
365 if (thread->dabr) { 367 if (thread->dabr) {
366 thread->dabr = 0; 368 thread->dabr = 0;
367 set_dabr(0); 369 thread->dabrx = 0;
370 set_dabr(0, 0);
368 } 371 }
369} 372}
370#endif /* !CONFIG_HAVE_HW_BREAKPOINT */ 373#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
371#endif /* CONFIG_PPC_ADV_DEBUG_REGS */ 374#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
372 375
373int set_dabr(unsigned long dabr) 376int set_dabr(unsigned long dabr, unsigned long dabrx)
374{ 377{
375 __get_cpu_var(current_dabr) = dabr; 378 __get_cpu_var(current_dabr) = dabr;
376 379
377 if (ppc_md.set_dabr) 380 if (ppc_md.set_dabr)
378 return ppc_md.set_dabr(dabr); 381 return ppc_md.set_dabr(dabr, dabrx);
379 382
380 /* XXX should we have a CPU_FTR_HAS_DABR ? */ 383 /* XXX should we have a CPU_FTR_HAS_DABR ? */
381#ifdef CONFIG_PPC_ADV_DEBUG_REGS 384#ifdef CONFIG_PPC_ADV_DEBUG_REGS
@@ -385,9 +388,8 @@ int set_dabr(unsigned long dabr)
385#endif 388#endif
386#elif defined(CONFIG_PPC_BOOK3S) 389#elif defined(CONFIG_PPC_BOOK3S)
387 mtspr(SPRN_DABR, dabr); 390 mtspr(SPRN_DABR, dabr);
391 mtspr(SPRN_DABRX, dabrx);
388#endif 392#endif
389
390
391 return 0; 393 return 0;
392} 394}
393 395
@@ -480,7 +482,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
480 */ 482 */
481#ifndef CONFIG_HAVE_HW_BREAKPOINT 483#ifndef CONFIG_HAVE_HW_BREAKPOINT
482 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) 484 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
483 set_dabr(new->thread.dabr); 485 set_dabr(new->thread.dabr, new->thread.dabrx);
484#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 486#endif /* CONFIG_HAVE_HW_BREAKPOINT */
485#endif 487#endif
486 488