diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
| commit | 37da2899f40661e3e9631e497da8dc59b971cbd0 (patch) | |
| tree | cbc6d4680e347d906f5fa7fca73214418741df72 /Solaris/sparc/include/fpuctl.h | |
| parent | 54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff) | |
20060303a
Diffstat (limited to 'Solaris/sparc/include/fpuctl.h')
| -rw-r--r-- | Solaris/sparc/include/fpuctl.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Solaris/sparc/include/fpuctl.h b/Solaris/sparc/include/fpuctl.h new file mode 100644 index 00000000..e91ee09b --- /dev/null +++ b/Solaris/sparc/include/fpuctl.h @@ -0,0 +1,75 @@ +/* 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 */ + +/* + * accrued exception bits in the fsr + */ +#define FPAINEX (1<<5) +#define FPAOVFL (1<<8) +#define FPAUNFL (1<<7) +#define FPAZDIV (1<<6) +#define FPAINVAL (1<<9) + +/* + * exception enable bits in the fsr + */ +#define FPINEX (1<<23) +#define FPOVFL (1<<26) +#define FPUNFL (1<<25) +#define FPZDIV (1<<24) +#define FPINVAL (1<<27) + +/* + * rounding + */ +#define FPRMASK (3<<30) +#define FPRNR (0<<30) +#define FPRNINF (3<<30) +#define FPRPINF (2<<30) +#define FPRZ (1<<30) + +/* + * precision + */ +#define FPPDBL 0 + +#define FPFCR (FPRMASK|FPINEX|FPOVFL|FPUNFL|FPZDIV|FPINVAL) +#define FPFSR (FPAINEX|FPAOVFL|FPAUNFL|FPAZDIV|FPAINVAL) + +static ulong +getfcr(void) +{ + ulong v; + + asm(" st %fsr, [%fp-8]"); + return v; +} + +static void +setfcr(ulong v) +{ + ulong vv; + + vv = (getfcr() & ~FPFCR) | (v & FPFCR); + asm(" ld [%fp-4], %fsr"); +} + +static ulong +getfsr(void) +{ + ulong v; + + asm(" st %fsr, [%fp-8]"); + return v; +} + +static void +setfsr(ulong v) +{ + ulong vv; + + vv = (getfsr() & ~FPFSR) | (v & FPFSR); + asm(" ld [%fp-4], %fsr"); +} + |
