Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / platform / pc32 / gnu / fpemul / status_w.h
1 /*
2  *  status_w.h
3  *
4  *
5  * Copyright (C) 1992,1993,1994
6  *                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,
7  *                       Australia.  E-mail   billm@vaxc.cc.monash.edu.au
8  * All rights reserved.
9  *
10  * This copyright notice covers the redistribution and use of the
11  * FPU emulator developed by W. Metzenthen. It covers only its use
12  * in the 386BSD, FreeBSD and NetBSD operating systems. Any other
13  * use is not permitted under this copyright.
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions
17  * are met:
18  * 1. Redistributions of source code must retain the above copyright
19  *    notice, this list of conditions and the following disclaimer.
20  * 2. Redistributions in binary form must include information specifying
21  *    that source code for the emulator is freely available and include
22  *    either:
23  *      a) an offer to provide the source code for a nominal distribution
24  *         fee, or
25  *      b) list at least two alternative methods whereby the source
26  *         can be obtained, e.g. a publically accessible bulletin board
27  *         and an anonymous ftp site from which the software can be
28  *         downloaded.
29  * 3. All advertising materials specifically mentioning features or use of
30  *    this emulator must acknowledge that it was developed by W. Metzenthen.
31  * 4. The name of W. Metzenthen may not be used to endorse or promote
32  *    products derived from this software without specific prior written
33  *    permission.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
36  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
37  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
38  * W. METZENTHEN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45  *
46  *
47  * The purpose of this copyright, based upon the Berkeley copyright, is to
48  * ensure that the covered software remains freely available to everyone.
49  *
50  * The software (with necessary differences) is also available, but under
51  * the terms of the GNU copyleft, for the Linux operating system and for
52  * the djgpp ms-dos extender.
53  *
54  * W. Metzenthen   June 1994.
55  *
56  *
57  * $FreeBSD: src/sys/gnu/i386/fpemul/status_w.h,v 1.6 1999/08/28 00:42:59 peter Exp $
58  *
59  */
60
61
62 #ifndef _STATUS_H_
63 #define _STATUS_H_
64
65
66 #ifdef LOCORE
67 #define Const__(x)      $/**/x
68 #else
69 #define Const__(x)      x
70 #endif
71
72 #define SW_Backward     Const__(0x8000) /* backward compatibility */
73 #define SW_C3           Const__(0x4000) /* condition bit 3 */
74 #define SW_Top          Const__(0x3800) /* top of stack */
75 #define SW_Top_Shift    Const__(11)     /* shift for top of stack bits */
76 #define SW_C2           Const__(0x0400) /* condition bit 2 */
77 #define SW_C1           Const__(0x0200) /* condition bit 1 */
78 #define SW_C0           Const__(0x0100) /* condition bit 0 */
79 #define SW_Summary      Const__(0x0080) /* exception summary */
80 #define SW_Stack_Fault  Const__(0x0040) /* stack fault */
81 #define SW_Precision    Const__(0x0020) /* loss of precision */
82 #define SW_Underflow    Const__(0x0010) /* underflow */
83 #define SW_Overflow     Const__(0x0008) /* overflow */
84 #define SW_Zero_Div     Const__(0x0004) /* divide by zero */
85 #define SW_Denorm_Op    Const__(0x0002) /* denormalized operand */
86 #define SW_Invalid      Const__(0x0001) /* invalid operation */
87
88 #define SW_Exc_Mask     Const__(0x27f)  /* Status word exception bit mask */
89
90 #ifndef LOCORE
91
92 #define COMP_A_gt_B     1
93 #define COMP_A_eq_B     2
94 #define COMP_A_lt_B     3
95 #define COMP_No_Comp    4
96 #define COMP_Denormal   0x20
97 #define COMP_NaN        0x40
98 #define COMP_SNaN       0x80
99
100 #define setcc(cc) ({ \
101   status_word &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \
102   status_word |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); })
103
104 #endif                          /* LOCORE */
105
106 #endif                          /* _STATUS_H_ */