home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / mach / i386 / fp_reg.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  6.0 KB  |  185 lines

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