shithub: purgatorio

Download patch

ref: 4bc20df7142ce5e02c7fb49a33eefdc7715ff726
parent: 995a32b23775fd83b4d808d713b8d885cc2b297b
author: Matthew Veety <mveety@gmail.com>
date: Thu Nov 8 19:57:40 EST 2018

FreeBSD builds.

--- 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