From 0d57a81a8be9e9b63084d2b57eaadc0e1d57f2b7 Mon Sep 17 00:00:00 2001 From: dfr Date: Wed, 23 Dec 1998 11:50:52 +0000 Subject: Implement fpsetmask() and other fp*() functions. Programs should use #include to access these functions instead of the i386 specific #include Submitted by: Hidetoshi Shimokawa --- sys/alpha/include/alpha_cpu.h | 8 +++++--- sys/alpha/include/fpu.h | 12 +++++++++++- sys/alpha/include/ieeefp.h | 16 +++++++++------- sys/alpha/include/sysarch.h | 6 ++++-- 4 files changed, 29 insertions(+), 13 deletions(-) (limited to 'sys/alpha/include') diff --git a/sys/alpha/include/alpha_cpu.h b/sys/alpha/include/alpha_cpu.h index 5107274..4bd1050 100644 --- a/sys/alpha/include/alpha_cpu.h +++ b/sys/alpha/include/alpha_cpu.h @@ -1,4 +1,4 @@ -/* $Id: alpha_cpu.h,v 1.2 1998/06/10 10:54:21 dfr Exp $ */ +/* $Id: alpha_cpu.h,v 1.3 1998/06/14 13:45:10 dfr Exp $ */ /* From: NetBSD: alpha_cpu.h,v 1.15 1997/09/20 19:02:34 mjacob Exp */ /* @@ -273,8 +273,10 @@ typedef unsigned long alpha_pt_entry_t; */ #define ALPHA_AMASK_BWX 0x0001 /* byte/word extension */ -#define ALPHA_AMASK_CIX 0x0002 /* count extension */ -#define ALPHA_AMASK_MAX 0x0100 /* multimedia extension */ +#define ALPHA_AMASK_FIX 0x0002 /* sqrt and f <-> i conversion extension */ +#define ALPHA_AMASK_CIX 0x0004 /* count extension */ +#define ALPHA_AMASK_MVI 0x0100 /* multimedia extension */ +#define ALPHA_AMASK_PRECISE 0x0200 /* Precise arithmetic traps */ /* * Chip family IDs returned by implver instruction diff --git a/sys/alpha/include/fpu.h b/sys/alpha/include/fpu.h index d4a767e..c9efcee 100644 --- a/sys/alpha/include/fpu.h +++ b/sys/alpha/include/fpu.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: fpu.h,v 1.1 1998/12/04 10:52:48 dfr Exp $ */ #ifndef _MACHINE_FPU_H_ @@ -105,6 +105,16 @@ #define IEEE_INHERIT (1LL << 63) /* inherit on fork */ +/* read and write floating point control register */ +#define GET_FPCR(x) \ + __asm__("trapb"); \ + __asm__("mf_fpcr %0" : "=f" (x)); \ + __asm__("trapb") +#define SET_FPCR(x) \ + __asm__("trapb"); \ + __asm__("mt_fpcr %0" : : "f" (x)); \ + __asm__("trapb") + #ifdef KERNEL extern int fp_software_completion(u_int64_t regmask, struct proc *p); diff --git a/sys/alpha/include/ieeefp.h b/sys/alpha/include/ieeefp.h index c0f4c2f..a838e98 100644 --- a/sys/alpha/include/ieeefp.h +++ b/sys/alpha/include/ieeefp.h @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: ieeefp.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */ /* From: NetBSD: ieeefp.h,v 1.2 1997/04/06 08:47:28 cgd Exp */ /* @@ -10,12 +10,14 @@ #define _ALPHA_IEEEFP_H_ typedef int fp_except; -#define FP_X_INV 0x01 /* invalid operation exception */ -#define FP_X_DZ 0x02 /* divide-by-zero exception */ -#define FP_X_OFL 0x04 /* overflow exception */ -#define FP_X_UFL 0x08 /* underflow exception */ -#define FP_X_IMP 0x10 /* imprecise (loss of precision; "inexact") */ -#define FP_X_IOV 0x20 /* integer overflow XXX? */ +#define FP_X_INV (1LL << 1) /* invalid operation exception */ +#define FP_X_DZ (1LL << 2) /* divide-by-zero exception */ +#define FP_X_OFL (1LL << 3) /* overflow exception */ +#define FP_X_UFL (1LL << 4) /* underflow exception */ +#define FP_X_IMP (1LL << 5) /* imprecise(inexact) exception */ +#if 0 +#define FP_X_IOV (1LL << 6) /* integer overflow XXX? */ +#endif typedef enum { FP_RZ=0, /* round to zero (truncate) */ diff --git a/sys/alpha/include/sysarch.h b/sys/alpha/include/sysarch.h index 61806f8..e0e0a6b 100644 --- a/sys/alpha/include/sysarch.h +++ b/sys/alpha/include/sysarch.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: sysarch.h,v 1.1 1998/11/17 10:40:07 dfr Exp $ */ /* @@ -39,7 +39,9 @@ #ifndef _MACHINE_SYSARCH_H_ #define _MACHINE_SYSARCH_H_ -#define ALPHA_SETHAE 0 +#define ALPHA_SETHAE 0 +#define ALPHA_GET_FPMASK 1 +#define ALPHA_SET_FPMASK 2 #ifndef KERNEL #include -- cgit v1.1