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 00039 #ifndef __X86EMU_FPU_REGS_H 00040 #define __X86EMU_FPU_REGS_H 00041 00042 #ifdef X86_FPU_SUPPORT 00043 00044 #pragma pack(1) 00045 00046 /* Basic 8087 register can hold any of the following values: */ 00047 00048 union x86_fpu_reg_u { 00049 s8 tenbytes[10]; 00050 double dval; 00051 float fval; 00052 s16 sval; 00053 s32 lval; 00054 }; 00055 00056 struct x86_fpu_reg { 00057 union x86_fpu_reg_u reg; 00058 char tag; 00059 }; 00060 00061 /* 00062 * Since we are not going to worry about the problems of aliasing 00063 * registers, every time a register is modified, its result type is 00064 * set in the tag fields for that register. If some operation 00065 * attempts to access the type in a way inconsistent with its current 00066 * storage format, then we flag the operation. If common, we'll 00067 * attempt the conversion. 00068 */ 00069 00070 #define X86_FPU_VALID 0x80 00071 #define X86_FPU_REGTYP(r) ((r) & 0x7F) 00072 00073 #define X86_FPU_WORD 0x0 00074 #define X86_FPU_SHORT 0x1 00075 #define X86_FPU_LONG 0x2 00076 #define X86_FPU_FLOAT 0x3 00077 #define X86_FPU_DOUBLE 0x4 00078 #define X86_FPU_LDBL 0x5 00079 #define X86_FPU_BSD 0x6 00080 00081 #define X86_FPU_STKTOP 0 00082 00083 struct x86_fpu_registers { 00084 struct x86_fpu_reg x86_fpu_stack[8]; 00085 int x86_fpu_flags; 00086 int x86_fpu_config; /* rounding modes, etc. */ 00087 short x86_fpu_tos, x86_fpu_bos; 00088 }; 00089 00090 #pragma pack() 00091 00092 /* 00093 * There are two versions of the following macro. 00094 * 00095 * One version is for opcode D9, for which there are more than 32 00096 * instructions encoded in the second byte of the opcode. 00097 * 00098 * The other version, deals with all the other 7 i87 opcodes, for 00099 * which there are only 32 strings needed to describe the 00100 * instructions. 00101 */ 00102 00103 #endif /* X86_FPU_SUPPORT */ 00104 00105 #ifdef DEBUG 00106 # define DECODE_PRINTINSTR32(t,mod,rh,rl) \ 00107 DECODE_PRINTF(t[(mod<<3)+(rh)]); 00108 # define DECODE_PRINTINSTR256(t,mod,rh,rl) \ 00109 DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]); 00110 #else 00111 # define DECODE_PRINTINSTR32(t,mod,rh,rl) 00112 # define DECODE_PRINTINSTR256(t,mod,rh,rl) 00113 #endif 00114 00115 #endif /* __X86EMU_FPU_REGS_H */