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