diff options
author | Rafal Jaworowski <raj@FreeBSD.org> | 2009-02-27 12:08:24 +0000 |
---|---|---|
committer | Rafal Jaworowski <raj@FreeBSD.org> | 2009-02-27 12:08:24 +0000 |
commit | 0a35b40f8dd4af0203eba5b31c73c80b10176c37 (patch) | |
tree | 8b41f61a7208bd8888ebad2d80a7da1d913c93f4 /sys/powerpc/booke/swtch.S | |
parent | 2a4f4fc1965e4fe365ee6ac97cebe26c19166d82 (diff) | |
download | src-0a35b40f8dd4af0203eba5b31c73c80b10176c37.tar.gz src-0a35b40f8dd4af0203eba5b31c73c80b10176c37.zip |
Make Book-E debug register state part of the PCB context.
Previously, DBCR0 flags were set "globally", but this leads to problems
because Book-E fine grained debug settings work only in conjuction with the
debug master enable bit in MSR: in scenarios when the DBCR0 was set with
intention to debug one process, but another one with MSR[DE] set got
scheduled, the latter would immediately cause debug exceptions to occur upon
execution of its own code instructions (and not the one intended for
debugging).
To avoid such problems and properly handle debugging context, DBCR0 state
should be managed individually per process.
Submitted by: Grzegorz Bernacki gjb ! semihalf dot com
Reviewed by: marcel
Notes
Notes:
svn path=/head/; revision=189100
Diffstat (limited to 'sys/powerpc/booke/swtch.S')
-rw-r--r-- | sys/powerpc/booke/swtch.S | 5 |
1 files changed, 5 insertions, 0 deletions
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 |