powerpc/booke: Clean up the hardware watchpoint support
* CONFIG_BOOKE is selected by CONFIG_44x so we dont need both * Fixed a few comments * Go back to only using DBCR0_IDM to determine if we are using debug resources. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
committed by
Benjamin Herrenschmidt
parent
d3b060231b
commit
2325f0a0c3
@@ -148,7 +148,7 @@ transfer_to_handler:
|
|||||||
/* Check to see if the dbcr0 register is set up to debug. Use the
|
/* Check to see if the dbcr0 register is set up to debug. Use the
|
||||||
internal debug mode bit to do this. */
|
internal debug mode bit to do this. */
|
||||||
lwz r12,THREAD_DBCR0(r12)
|
lwz r12,THREAD_DBCR0(r12)
|
||||||
andis. r12,r12,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h
|
andis. r12,r12,DBCR0_IDM@h
|
||||||
beq+ 3f
|
beq+ 3f
|
||||||
/* From user and task is ptraced - load up global dbcr0 */
|
/* From user and task is ptraced - load up global dbcr0 */
|
||||||
li r12,-1 /* clear all pending debug events */
|
li r12,-1 /* clear all pending debug events */
|
||||||
@@ -292,7 +292,7 @@ syscall_exit_cont:
|
|||||||
/* If the process has its own DBCR0 value, load it up. The internal
|
/* If the process has its own DBCR0 value, load it up. The internal
|
||||||
debug mode bit tells us that dbcr0 should be loaded. */
|
debug mode bit tells us that dbcr0 should be loaded. */
|
||||||
lwz r0,THREAD+THREAD_DBCR0(r2)
|
lwz r0,THREAD+THREAD_DBCR0(r2)
|
||||||
andis. r10,r0,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h
|
andis. r10,r0,DBCR0_IDM@h
|
||||||
bnel- load_dbcr0
|
bnel- load_dbcr0
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_44x
|
#ifdef CONFIG_44x
|
||||||
@@ -720,7 +720,7 @@ restore_user:
|
|||||||
/* Check whether this process has its own DBCR0 value. The internal
|
/* Check whether this process has its own DBCR0 value. The internal
|
||||||
debug mode bit tells us that dbcr0 should be loaded. */
|
debug mode bit tells us that dbcr0 should be loaded. */
|
||||||
lwz r0,THREAD+THREAD_DBCR0(r2)
|
lwz r0,THREAD+THREAD_DBCR0(r2)
|
||||||
andis. r10,r0,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h
|
andis. r10,r0,DBCR0_IDM@h
|
||||||
bnel- load_dbcr0
|
bnel- load_dbcr0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -254,7 +254,7 @@ void do_dabr(struct pt_regs *regs, unsigned long address,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Clear the DAC and struct entries. One shot trigger */
|
/* Clear the DAC and struct entries. One shot trigger */
|
||||||
#if (defined(CONFIG_44x) || defined(CONFIG_BOOKE))
|
#if defined(CONFIG_BOOKE)
|
||||||
mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R | DBSR_DAC1W
|
mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R | DBSR_DAC1W
|
||||||
| DBCR0_IDM));
|
| DBCR0_IDM));
|
||||||
#endif
|
#endif
|
||||||
@@ -286,7 +286,7 @@ int set_dabr(unsigned long dabr)
|
|||||||
mtspr(SPRN_DABR, dabr);
|
mtspr(SPRN_DABR, dabr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
|
#if defined(CONFIG_BOOKE)
|
||||||
mtspr(SPRN_DAC1, dabr);
|
mtspr(SPRN_DAC1, dabr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
|
|||||||
if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
|
if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
|
||||||
set_dabr(new->thread.dabr);
|
set_dabr(new->thread.dabr);
|
||||||
|
|
||||||
#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
|
#if defined(CONFIG_BOOKE)
|
||||||
/* If new thread DAC (HW breakpoint) is the same then leave it */
|
/* If new thread DAC (HW breakpoint) is the same then leave it */
|
||||||
if (new->thread.dabr)
|
if (new->thread.dabr)
|
||||||
set_dabr(new->thread.dabr);
|
set_dabr(new->thread.dabr);
|
||||||
@@ -568,7 +568,7 @@ void flush_thread(void)
|
|||||||
current->thread.dabr = 0;
|
current->thread.dabr = 0;
|
||||||
set_dabr(0);
|
set_dabr(0);
|
||||||
|
|
||||||
#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
|
#if defined(CONFIG_BOOKE)
|
||||||
current->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W);
|
current->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -717,7 +717,7 @@ void user_disable_single_step(struct task_struct *task)
|
|||||||
struct pt_regs *regs = task->thread.regs;
|
struct pt_regs *regs = task->thread.regs;
|
||||||
|
|
||||||
|
|
||||||
#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
|
#if defined(CONFIG_BOOKE)
|
||||||
/* If DAC then do not single step, skip */
|
/* If DAC then do not single step, skip */
|
||||||
if (task->thread.dabr)
|
if (task->thread.dabr)
|
||||||
return;
|
return;
|
||||||
@@ -744,10 +744,11 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
|
|||||||
if (addr > 0)
|
if (addr > 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
/* The bottom 3 bits in dabr are flags */
|
||||||
if ((data & ~0x7UL) >= TASK_SIZE)
|
if ((data & ~0x7UL) >= TASK_SIZE)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
#ifdef CONFIG_PPC64
|
#ifndef CONFIG_BOOKE
|
||||||
|
|
||||||
/* For processors using DABR (i.e. 970), the bottom 3 bits are flags.
|
/* For processors using DABR (i.e. 970), the bottom 3 bits are flags.
|
||||||
* It was assumed, on previous implementations, that 3 bits were
|
* It was assumed, on previous implementations, that 3 bits were
|
||||||
@@ -769,7 +770,7 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
|
|||||||
task->thread.dabr = data;
|
task->thread.dabr = data;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
|
#if defined(CONFIG_BOOKE)
|
||||||
|
|
||||||
/* As described above, it was assumed 3 bits were passed with the data
|
/* As described above, it was assumed 3 bits were passed with the data
|
||||||
* address, but we will assume only the mode bits will be passed
|
* address, but we will assume only the mode bits will be passed
|
||||||
|
@@ -147,7 +147,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
|
|||||||
*/
|
*/
|
||||||
if (current->thread.dabr) {
|
if (current->thread.dabr) {
|
||||||
set_dabr(current->thread.dabr);
|
set_dabr(current->thread.dabr);
|
||||||
#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
|
#if defined(CONFIG_BOOKE)
|
||||||
mtspr(SPRN_DBCR0, current->thread.dbcr0);
|
mtspr(SPRN_DBCR0, current->thread.dbcr0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user