From 77e0feb67c2a5cf37d23810504a28fdc3c7ad380 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 24 Dec 2014 20:53:58 +0100 Subject: [PATCH] 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. --- sys/src/9/zynq/l.s | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/sys/src/9/zynq/l.s b/sys/src/9/zynq/l.s index a02ac6c7c..ee8f308a2 100644 --- a/sys/src/9/zynq/l.s +++ b/sys/src/9/zynq/l.s @@ -307,14 +307,6 @@ TEXT fpinit(SB), $0 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 @@ TEXT fprestore(SB), $0 WORD $0xecf00b20 RET -TEXT fpoff(SB), $0 - MOVW $0, R1 - VMSR(0xe, 1, FPEXC) - RET - -TEXT fpclear(SB), $0 +TEXT fpsave(SB), $0 VMRS(0xe, FPEXC, 1) - AND $(3<<30), R1 + VMRS(0xe, FPSCR, 2) + MOVM.IA.W [R1-R2], (R0) + WORD $0xeca00b20 + WORD $0xece00b20 + /* wet floor */ + +TEXT fpoff(SB), $0 +TEXT fpclear(SB), $0 + MOVW $0, R1 VMSR(0xe, 1, FPEXC) RET