libhd 5.0
fpu_regs.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 *
00003 *                                               Realmode X86 Emulator Library
00004 *
00005 *               Copyright (C) 1996-1999 SciTech Software, Inc.
00006 *                                    Copyright (C) David Mosberger-Tang
00007 *                                          Copyright (C) 1999 Egbert Eich
00008 *
00009 *  ========================================================================
00010 *
00011 *  Permission to use, copy, modify, distribute, and sell this software and
00012 *  its documentation for any purpose is hereby granted without fee,
00013 *  provided that the above copyright notice appear in all copies and that
00014 *  both that copyright notice and this permission notice appear in
00015 *  supporting documentation, and that the name of the authors not be used
00016 *  in advertising or publicity pertaining to distribution of the software
00017 *  without specific, written prior permission.  The authors makes no
00018 *  representations about the suitability of this software for any purpose.
00019 *  It is provided "as is" without express or implied warranty.
00020 *
00021 *  THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00022 *  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
00023 *  EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
00024 *  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
00025 *  USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
00026 *  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00027 *  PERFORMANCE OF THIS SOFTWARE.
00028 *
00029 *  ========================================================================
00030 *
00031 * Language:             ANSI C
00032 * Environment:  Any
00033 * Developer:    Kendall Bennett
00034 *
00035 * Description:  Header file for FPU register definitions.
00036 *
00037 ****************************************************************************/
00038 /* $XFree86: xc/extras/x86emu/include/x86emu/fpu_regs.h,v 1.2 2003/10/22 20:03:05 tsi Exp $ */
00039 
00040 #ifndef __X86EMU_FPU_REGS_H
00041 #define __X86EMU_FPU_REGS_H
00042 
00043 #ifdef X86_FPU_SUPPORT
00044 
00045 #ifdef PACK
00046 # pragma PACK
00047 #endif
00048 
00049 /* Basic 8087 register can hold any of the following values: */
00050 
00051 union x86_fpu_reg_u {
00052     s8                  tenbytes[10];
00053     double              dval;
00054     float               fval;
00055     s16                 sval;
00056     s32                 lval;
00057         };
00058 
00059 struct x86_fpu_reg {
00060         union x86_fpu_reg_u reg;
00061         char                tag;
00062         };
00063 
00064 /*
00065  * Since we are not going to worry about the problems of aliasing
00066  * registers, every time a register is modified, its result type is
00067  * set in the tag fields for that register.  If some operation
00068  * attempts to access the type in a way inconsistent with its current
00069  * storage format, then we flag the operation.  If common, we'll
00070  * attempt the conversion.
00071  */
00072 
00073 #define  X86_FPU_VALID          0x80
00074 #define  X86_FPU_REGTYP(r)      ((r) & 0x7F)
00075 
00076 #define  X86_FPU_WORD           0x0
00077 #define  X86_FPU_SHORT          0x1
00078 #define  X86_FPU_LONG           0x2
00079 #define  X86_FPU_FLOAT          0x3
00080 #define  X86_FPU_DOUBLE         0x4
00081 #define  X86_FPU_LDBL           0x5
00082 #define  X86_FPU_BSD            0x6
00083 
00084 #define  X86_FPU_STKTOP  0
00085 
00086 struct x86_fpu_registers {
00087     struct x86_fpu_reg  x86_fpu_stack[8];
00088     int                 x86_fpu_flags;
00089     int                 x86_fpu_config;         /* rounding modes, etc. */
00090     short               x86_fpu_tos, x86_fpu_bos;
00091         };
00092 
00093 #ifdef END_PACK
00094 # pragma END_PACK
00095 #endif
00096 
00097 /*
00098  * There are two versions of the following macro.
00099  *
00100  * One version is for opcode D9, for which there are more than 32
00101  * instructions encoded in the second byte of the opcode.
00102  *
00103  * The other version, deals with all the other 7 i87 opcodes, for
00104  * which there are only 32 strings needed to describe the
00105  * instructions.
00106  */
00107 
00108 #endif /* X86_FPU_SUPPORT */
00109 
00110 #ifdef DEBUG
00111 # define DECODE_PRINTINSTR32(t,mod,rh,rl)       \
00112         DECODE_PRINTF(t[(mod<<3)+(rh)]);
00113 # define DECODE_PRINTINSTR256(t,mod,rh,rl)      \
00114         DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]);
00115 #else
00116 # define DECODE_PRINTINSTR32(t,mod,rh,rl)
00117 # define DECODE_PRINTINSTR256(t,mod,rh,rl)
00118 #endif
00119 
00120 #endif /* __X86EMU_FPU_REGS_H */