summaryrefslogtreecommitdiff
path: root/lib9/setfcr-Solaris-sparc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9/setfcr-Solaris-sparc.c')
-rw-r--r--lib9/setfcr-Solaris-sparc.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib9/setfcr-Solaris-sparc.c b/lib9/setfcr-Solaris-sparc.c
new file mode 100644
index 00000000..405e9cf2
--- /dev/null
+++ b/lib9/setfcr-Solaris-sparc.c
@@ -0,0 +1,42 @@
+/* This code is a little awkward. If somebody who understands Solaris
+ better would tell me an idiomatic way to invoke equivalent
+ behavior, I'd be grateful. ehg@bell-labs.com */
+
+#include "lib9.h"
+
+ulong
+getfcr(void)
+{
+ ulong v;
+
+ asm(" st %fsr, [%fp-8]");
+ return v;
+}
+
+void
+setfcr(ulong v)
+{
+ ulong vv;
+
+ vv = (getfcr() & ~FPFCR) | (v & FPFCR);
+ asm(" ld [%fp-4], %fsr");
+}
+
+ulong
+getfsr(void)
+{
+ ulong v;
+
+ asm(" st %fsr, [%fp-8]");
+ return v;
+}
+
+void
+setfsr(ulong v)
+{
+ ulong vv;
+
+ vv = (getfsr() & ~FPFSR) | (v & FPFSR);
+ asm(" ld [%fp-4], %fsr");
+}
+