shithub: riscv

Download patch

ref: 5aa224c153db83a9fe82848860a062c7c3566cc5
parent: e880549da638e3fa20465e7ed90d3803aa28fc18
author: cinap_lenrek <[email protected]>
date: Sun May 1 17:51:15 EDT 2016

pc: use fpsave() instead of fpenv() to capture fp exception context

--- a/sys/src/9/pc/fns.h
+++ b/sys/src/9/pc/fns.h
@@ -35,7 +35,6 @@
 int	ecwrite(uchar addr, uchar val);
 #define	evenaddr(x)				/* x86 doesn't care */
 void	fpclear(void);
-void	fpenv(FPsave*);
 void	fpinit(void);
 void	fpoff(void);
 void	(*fprestore)(FPsave*);
@@ -44,7 +43,6 @@
 void	fpsserestore0(FPsave*);
 void	fpssesave(FPsave*);
 void	fpssesave0(FPsave*);
-ulong	fpstatus(void);
 void	fpx87restore(FPsave*);
 void	fpx87restore0(FPsave*);
 void	fpx87save(FPsave*);
--- a/sys/src/9/pc/l.s
+++ b/sys/src/9/pc/l.s
@@ -612,15 +612,6 @@
 	WAIT
 	RET
 
-TEXT fpstatus(SB), $0				/* get floating point status */
-	FSTSW	AX
-	RET
-
-TEXT fpenv(SB), $0				/* save state without waiting */
-	MOVL	p+0(FP), AX
-	FSTENV	0(AX)
-	RET
-
 TEXT fpclear(SB), $0				/* clear pending exceptions */
 	FPON
 	FCLEX					/* no WAIT */
--- a/sys/src/9/pc/main.c
+++ b/sys/src/9/pc/main.c
@@ -706,8 +706,9 @@
 	/*
 	 *  get floating point state to check out error
 	 */
-	fpenv(&up->fpsave);
-	mathnote(up->fpsave.status, up->fpsave.pc);
+	fpsave(&up->fpsave);
+	up->fpstate = FPinactive;
+	mathnote(up->fpsave.fsw, up->fpsave.fpuip);
 }
 
 /*