]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/xmon/xmon.c
powerpc: Hardware breakpoints rewrite to handle non DABR breakpoint registers
[karo-tx-linux.git] / arch / powerpc / xmon / xmon.c
index 1f8d2f10a432442c2419228d1e7cc4cb120020ef..529c1ed7f59f2fcb4e17b3f411fb47b40d2e4c1e 100644 (file)
@@ -43,6 +43,7 @@
 #include <asm/setjmp.h>
 #include <asm/reg.h>
 #include <asm/debug.h>
+#include <asm/hw_breakpoint.h>
 
 #ifdef CONFIG_PPC64
 #include <asm/hvcall.h>
@@ -607,7 +608,7 @@ static int xmon_sstep(struct pt_regs *regs)
        return 1;
 }
 
-static int xmon_dabr_match(struct pt_regs *regs)
+static int xmon_break_match(struct pt_regs *regs)
 {
        if ((regs->msr & (MSR_IR|MSR_PR|MSR_64BIT)) != (MSR_IR|MSR_64BIT))
                return 0;
@@ -740,8 +741,14 @@ static void insert_bpts(void)
 
 static void insert_cpu_bpts(void)
 {
-       if (dabr.enabled)
-               set_dabr(dabr.address | (dabr.enabled & 7), DABRX_ALL);
+       struct arch_hw_breakpoint brk;
+
+       if (dabr.enabled) {
+               brk.address = dabr.address;
+               brk.type = (dabr.enabled & HW_BRK_TYPE_DABR) | HW_BRK_TYPE_PRIV_ALL;
+               brk.len = 8;
+               set_break(&brk);
+       }
        if (iabr && cpu_has_feature(CPU_FTR_IABR))
                mtspr(SPRN_IABR, iabr->address
                         | (iabr->enabled & (BP_IABR|BP_IABR_TE)));
@@ -769,7 +776,7 @@ static void remove_bpts(void)
 
 static void remove_cpu_bpts(void)
 {
-       set_dabr(0, 0);
+       hw_breakpoint_disable();
        if (cpu_has_feature(CPU_FTR_IABR))
                mtspr(SPRN_IABR, 0);
 }
@@ -1138,7 +1145,7 @@ bpt_cmds(void)
                                printf(badaddr);
                                break;
                        }
-                       dabr.address &= ~7;
+                       dabr.address &= ~HW_BRK_TYPE_DABR;
                        dabr.enabled = mode | BP_DABR;
                }
                break;
@@ -2917,7 +2924,7 @@ static void xmon_init(int enable)
                __debugger_bpt = xmon_bpt;
                __debugger_sstep = xmon_sstep;
                __debugger_iabr_match = xmon_iabr_match;
-               __debugger_dabr_match = xmon_dabr_match;
+               __debugger_break_match = xmon_break_match;
                __debugger_fault_handler = xmon_fault_handler;
        } else {
                __debugger = NULL;
@@ -2925,7 +2932,7 @@ static void xmon_init(int enable)
                __debugger_bpt = NULL;
                __debugger_sstep = NULL;
                __debugger_iabr_match = NULL;
-               __debugger_dabr_match = NULL;
+               __debugger_break_match = NULL;
                __debugger_fault_handler = NULL;
        }
 }