]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * Copyright (c) 1992 NeXT Computer, Inc. | |
27 | * | |
28 | * Intel386 Family: Floating Point unit. | |
29 | * | |
30 | * HISTORY | |
31 | * | |
32 | * 5 October 1992 ? at NeXT | |
33 | * Added names to previously unamed fields in the mantissa. | |
34 | * | |
35 | * 5 April 1992 ? at NeXT | |
36 | * Created. | |
37 | */ | |
38 | ||
39 | /* | |
40 | * Data register. | |
41 | */ | |
42 | ||
43 | typedef struct fp_data_reg { | |
44 | unsigned short mant; | |
45 | unsigned short mant1 :16, | |
46 | mant2 :16, | |
47 | mant3 :16; | |
48 | unsigned short exp :15, | |
49 | sign :1; | |
50 | } fp_data_reg_t; | |
51 | ||
52 | /* | |
53 | * Data register stack. | |
54 | */ | |
55 | ||
56 | typedef struct fp_stack { | |
57 | fp_data_reg_t ST[8]; | |
58 | } fp_stack_t; | |
59 | ||
60 | /* | |
61 | * Register stack tag word. | |
62 | */ | |
63 | ||
64 | typedef struct fp_tag { | |
65 | unsigned short tag0 :2, | |
66 | tag1 :2, | |
67 | tag2 :2, | |
68 | tag3 :2, | |
69 | tag4 :2, | |
70 | tag5 :2, | |
71 | tag6 :2, | |
72 | tag7 :2; | |
73 | #define FP_TAG_VALID 0 | |
74 | #define FP_TAG_ZERO 1 | |
75 | #define FP_TAG_SPEC 2 | |
76 | #define FP_TAG_EMPTY 3 | |
77 | } fp_tag_t; | |
78 | ||
79 | /* | |
80 | * Status word. | |
81 | */ | |
82 | ||
83 | typedef struct fp_status { | |
84 | unsigned short invalid :1, | |
85 | denorm :1, | |
86 | zdiv :1, | |
87 | ovrfl :1, | |
88 | undfl :1, | |
89 | precis :1, | |
90 | stkflt :1, | |
91 | errsumm :1, | |
92 | c0 :1, | |
93 | c1 :1, | |
94 | c2 :1, | |
95 | tos :3, | |
96 | c3 :1, | |
97 | busy :1; | |
98 | } fp_status_t; | |
99 | ||
100 | /* | |
101 | * Control word. | |
102 | */ | |
103 | ||
104 | typedef struct fp_control { | |
105 | unsigned short invalid :1, | |
106 | denorm :1, | |
107 | zdiv :1, | |
108 | ovrfl :1, | |
109 | undfl :1, | |
110 | precis :1, | |
111 | :2, | |
112 | pc :2, | |
113 | #define FP_PREC_24B 0 | |
114 | #define FP_PREC_53B 2 | |
115 | #define FP_PREC_64B 3 | |
116 | rc :2, | |
117 | #define FP_RND_NEAR 0 | |
118 | #define FP_RND_DOWN 1 | |
119 | #define FP_RND_UP 2 | |
120 | #define FP_CHOP 3 | |
121 | /*inf*/ :1, | |
122 | :3; | |
123 | } fp_control_t; | |
124 | ||
125 | #include <architecture/i386/sel.h> | |
126 | ||
127 | /* | |
128 | * Floating point 'environment' | |
129 | * used by FSTENV/FLDENV instructions. | |
130 | */ | |
131 | ||
132 | typedef struct fp_env { | |
133 | fp_control_t control; | |
134 | unsigned short :16; | |
135 | fp_status_t status; | |
136 | unsigned short :16; | |
137 | fp_tag_t tag; | |
138 | unsigned short :16; | |
139 | unsigned int ip; | |
140 | sel_t cs; | |
141 | unsigned short opcode; | |
142 | unsigned int dp; | |
143 | sel_t ds; | |
144 | unsigned short :16; | |
145 | } fp_env_t; | |
146 | ||
147 | /* | |
148 | * Floating point state | |
149 | * used by FSAVE/FRSTOR instructions. | |
150 | */ | |
151 | ||
152 | typedef struct fp_state { | |
153 | fp_env_t environ; | |
154 | fp_stack_t stack; | |
155 | } fp_state_t; |