shithub: riscv

Download patch

ref: 77e0feb67c2a5cf37d23810504a28fdc3c7ad380
parent: 1c6daca577a0c017ff882cf57ddd09afe543e65f
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