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