git: 9front

Download patch

ref: 29bc652b9a10342c3e7ae98983422141a0c323c3
parent: bc196137372f5b7c32dfc880d6e72d905ff3292c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Dec 24 15:53:58 EST 2014

zynq: fpsave() and fpclear() both need to disable the fpu

fpsave needs to disable the fpu! otherwise we won't catch
the mathtrap() in the kernel or when context switching to
another process that will attempt to use it.

--- a/sys/src/9/zynq/l.s
+++ b/sys/src/9/zynq/l.s
@@ -307,14 +307,6 @@
 	VMSR(0xe, 0, FPSCR)
 	RET
 
-TEXT fpsave(SB), $0
-	VMRS(0xe, FPEXC, 1)
-	VMRS(0xe, FPSCR, 2)
-	MOVM.IA.W [R1-R2], (R0)
-	WORD $0xeca00b20
-	WORD $0xece00b20
-	RET
-
 TEXT fprestore(SB), $0
 	MOVM.IA.W (R0), [R1-R2]
 	VMSR(0xe, 1, FPEXC)
@@ -323,14 +315,17 @@
 	WORD $0xecf00b20
 	RET
 
-TEXT fpoff(SB), $0
-	MOVW $0, R1
-	VMSR(0xe, 1, FPEXC)
-	RET
+TEXT fpsave(SB), $0
+	VMRS(0xe, FPEXC, 1)
+	VMRS(0xe, FPSCR, 2)
+	MOVM.IA.W [R1-R2], (R0)
+	WORD $0xeca00b20
+	WORD $0xece00b20
+	/* wet floor */
 
+TEXT fpoff(SB), $0
 TEXT fpclear(SB), $0
-	VMRS(0xe, FPEXC, 1)
-	AND $(3<<30), R1
+	MOVW $0, R1
 	VMSR(0xe, 1, FPEXC)
 	RET
 
--