aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/booke
diff options
context:
space:
mode:
authorNathan Whitehorn <nwhitehorn@FreeBSD.org>2013-11-17 14:44:22 +0000
committerNathan Whitehorn <nwhitehorn@FreeBSD.org>2013-11-17 14:44:22 +0000
commitdebe44551207018d9b9e123536693e74acfd0bbd (patch)
treefaec530c93bef836627d6a6f15ff9981b38e2dbf /sys/powerpc/booke
parent309c874c28b28bc44937a9410bfbbe2a7af7a468 (diff)
downloadsrc-debe44551207018d9b9e123536693e74acfd0bbd.tar.gz
src-debe44551207018d9b9e123536693e74acfd0bbd.zip
Split the function of the PCB_FPU flags into two: PCB_FPU now indicates that
the actual FPU is enabled, while PCB_FPREGS indicates that the FPU state structure in the PCB is valid. This separation reflects the situation on FPU-less systems in which the FP state is used by the emulator but we don't actually want to try to turn on the non-existant FPU. Use this flag to save and restore FP regs properly on both AIM and Book-E. As a side effect, this sets up hard-FP and Altivec on Book-E CPUs with such abilities except for a trap handler to call enable_fpu()/enable_altivec().
Notes
Notes: svn path=/head/; revision=258257
Diffstat (limited to 'sys/powerpc/booke')
-rw-r--r--sys/powerpc/booke/trap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/powerpc/booke/trap.c b/sys/powerpc/booke/trap.c
index 959d8b1d0666..72c4f474f631 100644
--- a/sys/powerpc/booke/trap.c
+++ b/sys/powerpc/booke/trap.c
@@ -194,6 +194,11 @@ trap(struct trapframe *frame)
case EXC_PGM: /* Program exception */
#ifdef FPU_EMU
+ if (!(td->td_pcb->pcb_flags & PCB_FPREGS)) {
+ bzero(&td->td_pcb->pcb_fpu,
+ sizeof(td->td_pcb->pcb_fpu));
+ td->td_pcb->pcb_flags |= PCB_FPREGS;
+ }
sig = fpu_emulate(frame,
(struct fpreg *)&td->td_pcb->pcb_fpu);
#else