diff options
Diffstat (limited to 'lib9')
| -rw-r--r-- | lib9/setfcr-DragonFly-386.c | 56 | ||||
| -rw-r--r-- | lib9/setfcr-Linux-arm.c | 32 | ||||
| -rw-r--r-- | lib9/setfcr-Linux-power.S | 20 | ||||
| -rw-r--r-- | lib9/setfcr-MacOSX-386.c | 56 | ||||
| -rw-r--r-- | lib9/setfcr-MacOSX-power.c | 39 | ||||
| -rw-r--r-- | lib9/setfcr-NetBSD-386.c | 55 | ||||
| -rw-r--r-- | lib9/setfcr-OpenBSD-386.c | 57 | ||||
| -rw-r--r-- | lib9/setfcr-Solaris-sparc.c | 42 |
8 files changed, 0 insertions, 357 deletions
diff --git a/lib9/setfcr-DragonFly-386.c b/lib9/setfcr-DragonFly-386.c deleted file mode 100644 index 3589dd80..00000000 --- a/lib9/setfcr-DragonFly-386.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Linux 386 fpu support - * Mimic Plan9 floating point support - */ - -#include "lib9.h" - -void -setfcr(ulong fcr) -{ - __asm__( "xorb $0x3f, %%al\n\t" - "pushw %%ax\n\t" - "fwait\n\t" - "fldcw (%%esp)\n\t" - "popw %%ax\n\t" - : /* no output */ - : "al" (fcr) - ); -} - -ulong -getfcr(void) -{ - ulong fcr = 0; - - __asm__( "pushl %%eax\n\t" - "fwait\n\t" - "fstcw (%%esp)\n\t" - "popl %%eax\n\t" - "xorb $0x3f, %%al\n\t" - : "=a" (fcr) - : "eax" (fcr) - ); - return fcr; -} - -ulong -getfsr(void) -{ - ulong fsr = -1; - - __asm__( "fwait\n\t" - "fstsw (%%eax)\n\t" - "movl (%%eax), %%eax\n\t" - "andl $0xffff, %%eax\n\t" - : "=a" (fsr) - : "eax" (&fsr) - ); - return fsr; -} - -void -setfsr(ulong fsr) -{ - __asm__("fclex\n\t"); -} diff --git a/lib9/setfcr-Linux-arm.c b/lib9/setfcr-Linux-arm.c deleted file mode 100644 index eb77b872..00000000 --- a/lib9/setfcr-Linux-arm.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Linux arm fpu support - * Mimic Plan9 floating point support - */ - -#include "lib9.h" - -#include <fenv.h> - -void -setfcr(ulong fcr) -{ -} - -ulong -getfcr(void) -{ - ulong fcr = 0; - return fcr; -} - -ulong -getfsr(void) -{ - ulong fsr = -1; - return fsr; -} - -void -setfsr(ulong fsr) -{ -} diff --git a/lib9/setfcr-Linux-power.S b/lib9/setfcr-Linux-power.S deleted file mode 100644 index dee67528..00000000 --- a/lib9/setfcr-Linux-power.S +++ /dev/null @@ -1,20 +0,0 @@ - -#define FN(x) .type x,@function; .global x; x - -FN(getfcr): - mffs %f0 - cvtfl %r3,%f0 - blr - -FN(getfsr): - mffs %f0 - cvtfl %r3,%f0 - blr - -FN(setfsr): - mtfsf 0xff, %f0 - blr - -FN(setfcr): - mtfsf 0xff, %f0 - blr diff --git a/lib9/setfcr-MacOSX-386.c b/lib9/setfcr-MacOSX-386.c deleted file mode 100644 index 3589dd80..00000000 --- a/lib9/setfcr-MacOSX-386.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Linux 386 fpu support - * Mimic Plan9 floating point support - */ - -#include "lib9.h" - -void -setfcr(ulong fcr) -{ - __asm__( "xorb $0x3f, %%al\n\t" - "pushw %%ax\n\t" - "fwait\n\t" - "fldcw (%%esp)\n\t" - "popw %%ax\n\t" - : /* no output */ - : "al" (fcr) - ); -} - -ulong -getfcr(void) -{ - ulong fcr = 0; - - __asm__( "pushl %%eax\n\t" - "fwait\n\t" - "fstcw (%%esp)\n\t" - "popl %%eax\n\t" - "xorb $0x3f, %%al\n\t" - : "=a" (fcr) - : "eax" (fcr) - ); - return fcr; -} - -ulong -getfsr(void) -{ - ulong fsr = -1; - - __asm__( "fwait\n\t" - "fstsw (%%eax)\n\t" - "movl (%%eax), %%eax\n\t" - "andl $0xffff, %%eax\n\t" - : "=a" (fsr) - : "eax" (&fsr) - ); - return fsr; -} - -void -setfsr(ulong fsr) -{ - __asm__("fclex\n\t"); -} diff --git a/lib9/setfcr-MacOSX-power.c b/lib9/setfcr-MacOSX-power.c deleted file mode 100644 index 17b76a88..00000000 --- a/lib9/setfcr-MacOSX-power.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * MacOSX/Darwin ppc fpu support - * Mimic Plan9 floating point support - */ - -#include "lib9.h" -#include <architecture/ppc/fp_regs.h> - -__inline__ ulong -getfcr(void) -{ - ppc_fp_scr_t fpscr = get_fp_scr(); - return ((ulong *)&fpscr)[1]; -} - -ulong -getfsr(void) -{ - ppc_fp_scr_t fpscr = get_fp_scr(); - return ((ulong *)&fpscr)[1]; -} - -void -setfsr(ulong fsr) -{ - ppc_fp_scr_t fpscr; - // fpscr = get_fp_scr(); - (((ulong *)&fpscr)[1]) = fsr; - set_fp_scr(fpscr); -} - -void -setfcr(ulong fcr) -{ - ppc_fp_scr_t fpscr; - // fpscr = get_fp_scr(); - (((ulong *)&fpscr)[1]) = fcr; - set_fp_scr(fpscr); -} diff --git a/lib9/setfcr-NetBSD-386.c b/lib9/setfcr-NetBSD-386.c deleted file mode 100644 index e58171a3..00000000 --- a/lib9/setfcr-NetBSD-386.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Linux 386 fpu support - * Mimic Plan9 floating point support - */ -#include "lib9.h" - -void -setfcr(ulong fcr) -{ - __asm__( "xorb $0x3f, %%al\n\t" - "pushw %%ax\n\t" - "fwait\n\t" - "fldcw (%%esp)\n\t" - "popw %%ax\n\t" - : /* no output */ - : "al" (fcr) - ); -} - -ulong -getfcr(void) -{ - ulong fcr = 0; - - __asm__( "pushl %%eax\n\t" - "fwait\n\t" - "fstcw (%%esp)\n\t" - "popl %%eax\n\t" - "xorb $0x3f, %%al\n\t" - : "=a" (fcr) - : "eax" (fcr) - ); - return fcr; -} - -ulong -getfsr(void) -{ - ulong fsr = -1; - - __asm__( "fwait\n\t" - "fstsw (%%eax)\n\t" - "movl (%%eax), %%eax\n\t" - "andl $0xffff, %%eax\n\t" - : "=a" (fsr) - : "eax" (&fsr) - ); - return fsr; -} - -void -setfsr(ulong fsr) -{ - __asm__("fclex\n\t"); -} diff --git a/lib9/setfcr-OpenBSD-386.c b/lib9/setfcr-OpenBSD-386.c deleted file mode 100644 index c512f033..00000000 --- a/lib9/setfcr-OpenBSD-386.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 386 fpu support - * Mimic Plan9 floating point support - */ - -#include "lib9.h" - - -void -setfcr(ulong fcr) -{ - __asm__( "xorb $0x3f, %%al\n\t" - "pushw %%ax\n\t" - "fwait\n\t" - "fldcw (%%esp)\n\t" - "popw %%ax\n\t" - : /* no output */ - : "al" (fcr) - ); -} - -ulong -getfcr(void) -{ - ulong fcr = 0; - - __asm__( "pushl %%eax\n\t" - "fwait\n\t" - "fstcw (%%esp)\n\t" - "popl %%eax\n\t" - "xorb $0x3f, %%al\n\t" - : "=a" (fcr) - : "eax" (fcr) - ); - return fcr; -} - -ulong -getfsr(void) -{ - ulong fsr = -1; - - __asm__( "fwait\n\t" - "fstsw (%%eax)\n\t" - "movl (%%eax), %%eax\n\t" - "andl $0xffff, %%eax\n\t" - : "=a" (fsr) - : "eax" (&fsr) - ); - return fsr; -} - -void -setfsr(ulong fsr) -{ - __asm__("fclex\n\t"); -} diff --git a/lib9/setfcr-Solaris-sparc.c b/lib9/setfcr-Solaris-sparc.c deleted file mode 100644 index 405e9cf2..00000000 --- a/lib9/setfcr-Solaris-sparc.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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"); -} - |
