Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | /* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * The contents of this file constitute Original Code as defined in and * are subject to the Apple Public Source License Version 1.1 (the * "License"). You may not use this file except in compliance with the * License. Please obtain a copy of the License at * http://www.apple.com/publicsource and read it before using this file. * * This Original Code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. * * @APPLE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ */ /* * HISTORY * * Revision 1.1.1.1 1998/09/22 21:05:31 wsanchez * Import of Mac OS X kernel (~semeria) * * Revision 1.1.1.1 1998/03/07 02:25:47 wsanchez * Import of OSF Mach kernel (~mburg) * * Revision 1.2.6.1 1994/09/23 02:37:03 ezf * change marker to not FREE * [1994/09/22 21:39:57 ezf] * * Revision 1.2.2.2 1993/06/09 02:40:30 gm * Added to OSF/1 R1.3 from NMK15.0. * [1993/06/02 21:16:11 jeffc] * * Revision 1.2 1993/04/19 16:33:51 devrcs * ansi C conformance changes * [1993/02/02 18:56:01 david] * * Revision 1.1 1992/09/30 02:30:43 robert * Initial revision * * $EndLog$ */ /* CMU_HIST */ /* * Revision 2.1.1.1.2.1 92/03/03 16:21:23 jeffreyh * Merged up to Trunk * [92/02/26 jeffreyh] * * Revision 2.4 92/02/26 13:10:29 elf * Added stupid alaises to make i386/fpu.c compile. RVB will fix. * * [92/02/26 elf] * * Revision 2.3 92/02/26 12:47:46 elf * Installed from i386 directory. * [92/02/26 danner] * * * Revision 2.2 92/01/03 20:19:47 dbg * Move this file to mach/i386. Add FP_NO..FP_387 codes for * floating-point processor status. Error bits in control * register are masks, not enables. * [91/10/19 dbg] * */ /* CMU_ENDHIST */ /* * Mach Operating System * Copyright (c) 1992-1989 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* */ #ifndef _I386_FP_SAVE_H_ #define _I386_FP_SAVE_H_ /* * Floating point registers and status, as saved * and restored by FP save/restore instructions. */ struct i386_fp_save { unsigned short fp_control; /* control */ unsigned short fp_unused_1; unsigned short fp_status; /* status */ unsigned short fp_unused_2; unsigned short fp_tag; /* register tags */ unsigned short fp_unused_3; unsigned int fp_eip; /* eip at failed instruction */ unsigned short fp_cs; /* cs at failed instruction */ unsigned short fp_opcode; /* opcode of failed instruction */ unsigned int fp_dp; /* data address */ unsigned short fp_ds; /* data segment */ unsigned short fp_unused_4; }; struct i386_fp_regs { unsigned short fp_reg_word[5][8]; /* space for 8 80-bit FP registers */ }; /* note when allocating this data structure, it must be 16 byte aligned. */ struct i386_fx_save { unsigned short fx_control; /* control */ unsigned short fx_status; /* status */ unsigned char fx_tag; /* register tags */ unsigned char fx_bbz1; /* better be zero when calling fxrtstor */ unsigned short fx_opcode; unsigned int fx_eip; /* eip instruction */ unsigned short fx_cs; /* cs instruction */ unsigned short fx_bbz2; /* better be zero when calling fxrtstor */ unsigned int fx_dp; /* data address */ unsigned short fx_ds; /* data segment */ unsigned short fx_bbz3; /* better be zero when calling fxrtstor */ unsigned int fx_MXCSR; unsigned int fx_MXCSR_MASK; unsigned short fx_reg_word[8][8]; /* STx/MMx registers */ unsigned short fx_XMM_reg[8][8]; /* XMM0-XMM7 */ unsigned char fx_reserved[16*14]; /* reserved by intel for future expansion */ }; /* * Control register */ #define FPC_IE 0x0001 /* enable invalid operation exception */ #define FPC_IM FPC_IE #define FPC_DE 0x0002 /* enable denormalized operation exception */ #define FPC_DM FPC_DE #define FPC_ZE 0x0004 /* enable zero-divide exception */ #define FPC_ZM FPC_ZE #define FPC_OE 0x0008 /* enable overflow exception */ #define FPC_OM FPC_OE #define FPC_UE 0x0010 /* enable underflow exception */ #define FPC_PE 0x0020 /* enable precision exception */ #define FPC_PC 0x0300 /* precision control: */ #define FPC_PC_24 0x0000 /* 24 bits */ #define FPC_PC_53 0x0200 /* 53 bits */ #define FPC_PC_64 0x0300 /* 64 bits */ #define FPC_RC 0x0c00 /* rounding control: */ #define FPC_RC_RN 0x0000 /* round to nearest or even */ #define FPC_RC_RD 0x0400 /* round down */ #define FPC_RC_RU 0x0800 /* round up */ #define FPC_RC_CHOP 0x0c00 /* chop */ #define FPC_IC 0x1000 /* infinity control (obsolete) */ #define FPC_IC_PROJ 0x0000 /* projective infinity */ #define FPC_IC_AFF 0x1000 /* affine infinity (std) */ /* * Status register */ #define FPS_IE 0x0001 /* invalid operation */ #define FPS_DE 0x0002 /* denormalized operand */ #define FPS_ZE 0x0004 /* divide by zero */ #define FPS_OE 0x0008 /* overflow */ #define FPS_UE 0x0010 /* underflow */ #define FPS_PE 0x0020 /* precision */ #define FPS_SF 0x0040 /* stack flag */ #define FPS_ES 0x0080 /* error summary */ #define FPS_C0 0x0100 /* condition code bit 0 */ #define FPS_C1 0x0200 /* condition code bit 1 */ #define FPS_C2 0x0400 /* condition code bit 2 */ #define FPS_TOS 0x3800 /* top-of-stack pointer */ #define FPS_TOS_SHIFT 11 #define FPS_C3 0x4000 /* condition code bit 3 */ #define FPS_BUSY 0x8000 /* FPU busy */ /* * Kind of floating-point support provided by kernel. */ #define FP_NO 0 /* no floating point */ #define FP_SOFT 1 /* software FP emulator */ #define FP_287 2 /* 80287 */ #define FP_387 3 /* 80387 or 80486 */ #define FP_FXSR 4 /* Fast save/restore SIMD Extension */ #endif /* _I386_FP_SAVE_H_ */ |