summaryrefslogtreecommitdiff
path: root/lib9
diff options
context:
space:
mode:
authorValery Ushakov <uwe@stderr.spb.ru>2016-06-01 14:23:27 +0300
committerValery Ushakov <uwe@stderr.spb.ru>2016-06-01 14:23:27 +0300
commit49c7e6d3dd79dc7807b70e8f149798f28319957c (patch)
treef2843b8c956427908662499b78067eeac55bdc1e /lib9
parentecdaf43c2cae919113d803376965be93e6b880af (diff)
Move fpuctl.h stuff into lib9, like on Linux. Inline asm version is
probably mis-optimized by modern gcc, but I didn't bother investigating.
Diffstat (limited to 'lib9')
-rw-r--r--lib9/setfcr-NetBSD-386.S34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib9/setfcr-NetBSD-386.S b/lib9/setfcr-NetBSD-386.S
new file mode 100644
index 00000000..d981f36a
--- /dev/null
+++ b/lib9/setfcr-NetBSD-386.S
@@ -0,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