aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/aim/swtch.S
diff options
context:
space:
mode:
authorMark Peek <mp@FreeBSD.org>2001-11-05 00:45:33 +0000
committerMark Peek <mp@FreeBSD.org>2001-11-05 00:45:33 +0000
commit8f718dfdc364db477026a133c1cd323109a245cf (patch)
tree9b64b7ee5b3e7f4d586652a6359ba7388887958b /sys/powerpc/aim/swtch.S
parentb46884b5b96cbc704ae362f6061070255ba3fa76 (diff)
downloadsrc-8f718dfdc364db477026a133c1cd323109a245cf.tar.gz
src-8f718dfdc364db477026a133c1cd323109a245cf.zip
Add enable_fpu/save_fpu for handling the floating point registers in the PCB.
Obtained from: NetBSD
Notes
Notes: svn path=/head/; revision=86066
Diffstat (limited to 'sys/powerpc/aim/swtch.S')
-rw-r--r--sys/powerpc/aim/swtch.S16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/powerpc/aim/swtch.S b/sys/powerpc/aim/swtch.S
index 97c15a5c8548..c8002648b354 100644
--- a/sys/powerpc/aim/swtch.S
+++ b/sys/powerpc/aim/swtch.S
@@ -80,6 +80,14 @@ ENTRY(cpu_switch)
mfcr %r4 /* Save the condition register */
stw %r4,PCB_CR(%r3)
+ lwz %r29,PCB_FLAGS(%r3)
+ andi. %r9, %r29, 1 /* XXX - don't hard code */
+ beq .L1
+ mr %r29, %r3 /* Save the PCB pointer */
+ bl save_fpu
+ mr %r3, %r29 /* and restore it */
+
+.L1:
bl choosethread /* Find a new thread to run */
mr %r14,%r3 /* Save off the (struct thread *) */
@@ -91,6 +99,14 @@ ENTRY(cpu_switch)
stw %r14,GD_CURTHREAD(%r4) /* Store new current thread */
lwz %r4,TD_PCB(%r14) /* Grab the new PCB */
+ lwz %r29, PCB_FLAGS(%r4) /* Restore FPU regs if needed */
+ andi. %r9, %r29, 1
+ beq .L2
+ mr %r29, %r4
+ bl enable_fpu
+ mr %r4, %r29
+
+.L2:
lmw %r14,PCB_CONTEXT(%r4) /* Load the non-volatile GP regs */
lwz %r5,PCB_CR(%r4) /* Load the condition register */
mtcr %r5