diff options
Diffstat (limited to 'sys/powerpc/booke')
-rw-r--r-- | sys/powerpc/booke/machdep.c | 7 | ||||
-rw-r--r-- | sys/powerpc/booke/swtch.S | 5 | ||||
-rw-r--r-- | sys/powerpc/booke/trap.c | 1 | ||||
-rw-r--r-- | sys/powerpc/booke/trap_subr.S | 6 |
4 files changed, 14 insertions, 5 deletions
diff --git a/sys/powerpc/booke/machdep.c b/sys/powerpc/booke/machdep.c index 1803ef23abc5..e42aa8c77f0c 100644 --- a/sys/powerpc/booke/machdep.c +++ b/sys/powerpc/booke/machdep.c @@ -806,14 +806,10 @@ int ptrace_single_step(struct thread *td) { struct trapframe *tf; - u_int reg; - - reg = mfspr(SPR_DBCR0); - reg |= DBCR0_IC | DBCR0_IDM; - mtspr(SPR_DBCR0, reg); tf = td->td_frame; tf->srr1 |= PSL_DE; + tf->cpu.booke.dbcr0 |= (DBCR0_IDM | DBCR0_IC); return (0); } @@ -824,6 +820,7 @@ ptrace_clear_single_step(struct thread *td) tf = td->td_frame; tf->srr1 &= ~PSL_DE; + tf->cpu.booke.dbcr0 &= ~(DBCR0_IDM | DBCR0_IC); return (0); } diff --git a/sys/powerpc/booke/swtch.S b/sys/powerpc/booke/swtch.S index 80bf2b3a459a..bfd7dd2c2204 100644 --- a/sys/powerpc/booke/swtch.S +++ b/sys/powerpc/booke/swtch.S @@ -66,6 +66,7 @@ #include <machine/param.h> #include <machine/psl.h> #include <machine/asm.h> +#include <machine/spr.h> /* * void cpu_switch(struct thread *old, struct thread *new) @@ -87,6 +88,8 @@ ENTRY(cpu_switch) stw %r16, PCB_BOOKE_CTR(%r5) mfxer %r16 stw %r16, PCB_BOOKE_XER(%r5) + mfspr %r16, SPR_DBCR0 + stw %r16, PCB_BOOKE_DBCR0(%r5) stw %r1, PCB_SP(%r5) /* Save the stack pointer */ @@ -114,6 +117,8 @@ ENTRY(cpu_switch) mtctr %r5 lwz %r5, PCB_BOOKE_XER(%r3) mtxer %r5 + lwz %r5, PCB_BOOKE_DBCR0(%r3) + mtspr SPR_DBCR0, %r5 lwz %r1, PCB_SP(%r3) /* Load the stack pointer */ blr diff --git a/sys/powerpc/booke/trap.c b/sys/powerpc/booke/trap.c index 88a0a51d9fd7..0e746f4f0c79 100644 --- a/sys/powerpc/booke/trap.c +++ b/sys/powerpc/booke/trap.c @@ -187,6 +187,7 @@ trap(struct trapframe *frame) case EXC_DEBUG: /* Single stepping */ mtspr(SPR_DBSR, mfspr(SPR_DBSR)); frame->srr1 &= ~PSL_DE; + frame->cpu.booke.dbcr0 &= ~(DBCR0_IDM || DBCR0_IC); sig = SIGTRAP; break; diff --git a/sys/powerpc/booke/trap_subr.S b/sys/powerpc/booke/trap_subr.S index f7a54a63146b..2a5820dbd2ca 100644 --- a/sys/powerpc/booke/trap_subr.S +++ b/sys/powerpc/booke/trap_subr.S @@ -207,6 +207,9 @@ stw %r4, FRAME_CTR+8(1); \ li %r5, exc; \ stw %r5, FRAME_EXC+8(1); \ + /* save DBCR0 */ \ + mfspr %r3, SPR_DBCR0; \ + stw %r3, FRAME_BOOKE_DBCR0+8(1); \ /* save xSSR0-1 */ \ lwz %r30, (savearea+CPUSAVE_SRR0)(%r2); \ lwz %r31, (savearea+CPUSAVE_SRR1)(%r2); \ @@ -231,6 +234,9 @@ mtxer %r5; \ mtlr %r6; \ mtcr %r7; \ + /* restore DBCR0 */ \ + lwz %r4, FRAME_BOOKE_DBCR0+8(%r1); \ + mtspr SPR_DBCR0, %r4; \ /* restore xSRR0-1 */ \ lwz %r30, FRAME_SRR0+8(%r1); \ lwz %r31, FRAME_SRR1+8(%r1); \ |