shithub: purgatorio

Download patch

ref: 9f76a7f6819ac04552b4fb6588156f3e4089d1d7
parent: ccd7f9f1597e56d121e1d05cf6af86f688ef2c48
parent: 4bc20df7142ce5e02c7fb49a33eefdc7715ff726
author: henesy <devnull@localhost>
date: Sun Nov 11 18:33:38 EST 2018

merge

--- a/FreeBSD/386/include/lib9.h
+++ b/FreeBSD/386/include/lib9.h
@@ -473,3 +473,31 @@
 
 #define	setbinmode()
 
+/* floating point things to get it to build. (stolen from netbsd) */
+
+/* FCR */
+#define	FPINEX	(1<<5)
+#define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
+#define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
+#define	FPRNR	(0<<10)
+#define	FPRZ	(3<<10)
+#define	FPRPINF	(2<<10)
+#define	FPRNINF	(1<<10)
+#define	FPRMASK	(3<<10)
+#define	FPPEXT	(3<<8)
+#define	FPPSGL	(0<<8)
+#define	FPPDBL	(2<<8)
+#define	FPPMASK	(3<<8)
+/* FSR */
+#define	FPAINEX	FPINEX
+#define	FPAOVFL	FPOVFL
+#define	FPAUNFL	FPUNFL
+#define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL
+
+extern	void	setfcr(ulong);
+extern	void	setfsr(ulong);
+extern	ulong	getfcr(void);
+extern	ulong	getfsr(void);
--- /dev/null
+++ b/lib9/setfcr-FreeBSD-386.S
@@ -1,0 +1,34 @@
+
+#define	FN(x)	.type x,@function; .global x; x
+#define	ENT	subl $16, %esp
+#define	RET	addl $16, %esp; ret
+
+	.file	"setfcr-Linux-386.S"
+FN(setfcr):
+	ENT
+	xorb	$0x3f, %al
+	movl	%eax, (%esp)
+	fwait
+	fldcw	(%esp)
+	RET
+
+FN(getfcr):
+	ENT
+	fwait
+	fstcw	(%esp)
+	movw	(%esp), %ax
+	andl	$0xffff, %eax
+	xorb	$0x3f, %al
+	RET
+
+FN(getfsr):
+	ENT
+	fwait
+	fstsw	(%esp)
+	movw	(%esp), %ax
+	andl	$0xffff, %eax
+	RET
+
+FN(setfsr):
+	fclex
+	ret