Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/architecture/i386/fpu.h

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
44typedef struct fp_data_reg {
45 unsigned shortmant;
46 unsigned shortmant1:16,
47mant2:16,
48mant3:16;
49 unsigned shortexp:15,
50 sign:1;
51} fp_data_reg_t;
52
53/*
54 * Data register stack.
55 */
56
57typedef struct fp_stack {
58 fp_data_reg_tST[8];
59} fp_stack_t;
60
61/*
62 * Register stack tag word.
63 */
64
65typedef struct fp_tag {
66 unsigned shorttag0:2,
67 tag1:2,
68tag2:2,
69tag3:2,
70 tag4:2,
71tag5:2,
72tag6:2,
73tag7:2;
74#define FP_TAG_VALID0
75#define FP_TAG_ZERO1
76#define FP_TAG_SPEC2
77#define FP_TAG_EMPTY3
78} fp_tag_t;
79
80/*
81 * Status word.
82 */
83
84typedef struct fp_status {
85 unsigned shortinvalid:1,
86 denorm:1,
87zdiv:1,
88ovrfl:1,
89undfl:1,
90precis:1,
91stkflt:1,
92errsumm:1,
93c0:1,
94c1:1,
95c2:1,
96tos:3,
97c3:1,
98busy:1;
99} fp_status_t;
100
101/*
102 * Control word.
103 */
104
105typedef struct fp_control {
106 unsigned shortinvalid:1,
107 denorm:1,
108zdiv:1,
109ovrfl:1,
110undfl:1,
111precis:1,
112:2,
113pc:2,
114#define FP_PREC_24B0
115#defineFP_PREC_53B2
116#define FP_PREC_64B3
117rc:2,
118#define FP_RND_NEAR0
119#define FP_RND_DOWN1
120#define FP_RND_UP2
121#define FP_CHOP3
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
133typedef struct fp_env {
134 fp_control_tcontrol;
135 unsigned short:16;
136 fp_status_tstatus;
137 unsigned short:16;
138 fp_tag_ttag;
139 unsigned short:16;
140 unsigned intip;
141 sel_tcs;
142 unsigned shortopcode;
143 unsigned intdp;
144 sel_tds;
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 */
160typedef struct fp_state {
161#if _ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_
162 fp_env_tenviron;
163 fp_stack_tstack;
164#else
165 fp_env_tfp_environ;
166 fp_stack_tfp_stack;
167#endif
168} fp_state_t;
169
170#endif/* _ARCH_I386_FPU_H_ */
171

Archive Download this file

Revision: 1622