GDB (API)
/home/stan/gdb/src/gdb/i387-tdep.h
Go to the documentation of this file.
00001 /* Target-dependent code for the i387.
00002 
00003    Copyright (C) 2000-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #ifndef I387_TDEP_H
00021 #define I387_TDEP_H
00022 
00023 struct gdbarch;
00024 struct frame_info;
00025 struct regcache;
00026 struct type;
00027 struct ui_file;
00028 
00029 /* Number of i387 floating point registers.  */
00030 #define I387_NUM_REGS   16
00031 
00032 #define I387_ST0_REGNUM(tdep) ((tdep)->st0_regnum)
00033 #define I387_NUM_XMM_REGS(tdep) ((tdep)->num_xmm_regs)
00034 #define I387_MM0_REGNUM(tdep) ((tdep)->mm0_regnum)
00035 #define I387_NUM_YMM_REGS(tdep) ((tdep)->num_ymm_regs)
00036 #define I387_YMM0H_REGNUM(tdep) ((tdep)->ymm0h_regnum)
00037 
00038 #define I387_FCTRL_REGNUM(tdep) (I387_ST0_REGNUM (tdep) + 8)
00039 #define I387_FSTAT_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 1)
00040 #define I387_FTAG_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 2)
00041 #define I387_FISEG_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 3)
00042 #define I387_FIOFF_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 4)
00043 #define I387_FOSEG_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 5)
00044 #define I387_FOOFF_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 6)
00045 #define I387_FOP_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 7)
00046 #define I387_XMM0_REGNUM(tdep) (I387_ST0_REGNUM (tdep) + 16)
00047 #define I387_MXCSR_REGNUM(tdep) \
00048   (I387_XMM0_REGNUM (tdep) + I387_NUM_XMM_REGS (tdep))
00049 #define I387_YMMENDH_REGNUM(tdep) \
00050   (I387_YMM0H_REGNUM (tdep) + I387_NUM_YMM_REGS (tdep))
00051 
00052 /* Print out the i387 floating point state.  */
00053 
00054 extern void i387_print_float_info (struct gdbarch *gdbarch,
00055                                    struct ui_file *file,
00056                                    struct frame_info *frame,
00057                                    const char *args);
00058 
00059 /* Return nonzero if a value of type TYPE stored in register REGNUM
00060    needs any special handling.  */
00061 
00062 extern int i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
00063                                     struct type *type);
00064 
00065 /* Read a value of type TYPE from register REGNUM in frame FRAME, and
00066    return its contents in TO.  */
00067 
00068 extern int i387_register_to_value (struct frame_info *frame, int regnum,
00069                                    struct type *type, gdb_byte *to,
00070                                    int *optimizedp, int *unavailablep);
00071 
00072 /* Write the contents FROM of a value of type TYPE into register
00073    REGNUM in frame FRAME.  */
00074 
00075 extern void i387_value_to_register (struct frame_info *frame, int regnum,
00076                                     struct type *type, const gdb_byte *from);
00077 
00078 
00079 /* Size of the memory area use by the 'fsave' and 'fxsave'
00080    instructions.  */
00081 #define I387_SIZEOF_FSAVE       108
00082 #define I387_SIZEOF_FXSAVE      512
00083 
00084 /* Fill register REGNUM in REGCACHE with the appropriate value from
00085    *FSAVE.  This function masks off any of the reserved bits in
00086    *FSAVE.  */
00087 
00088 extern void i387_supply_fsave (struct regcache *regcache, int regnum,
00089                                const void *fsave);
00090 
00091 /* Fill register REGNUM (if it is a floating-point register) in *FSAVE
00092    with the value from REGCACHE.  If REGNUM is -1, do this for all
00093    registers.  This function doesn't touch any of the reserved bits in
00094    *FSAVE.  */
00095 
00096 extern void i387_collect_fsave (const struct regcache *regcache, int regnum,
00097                                 void *fsave);
00098 
00099 /* Fill register REGNUM in REGCACHE with the appropriate
00100    floating-point or SSE register value from *FXSAVE.  This function
00101    masks off any of the reserved bits in *FXSAVE.  */
00102 
00103 extern void i387_supply_fxsave (struct regcache *regcache, int regnum,
00104                                 const void *fxsave);
00105 
00106 /* Similar to i387_supply_fxsave, but use XSAVE extended state.  */
00107 
00108 extern void i387_supply_xsave (struct regcache *regcache, int regnum,
00109                                const void *xsave);
00110 
00111 /* Fill register REGNUM (if it is a floating-point or SSE register) in
00112    *FXSAVE with the value from REGCACHE.  If REGNUM is -1, do this for
00113    all registers.  This function doesn't touch any of the reserved
00114    bits in *FXSAVE.  */
00115 
00116 extern void i387_collect_fxsave (const struct regcache *regcache, int regnum,
00117                                  void *fxsave);
00118 
00119 /* Similar to i387_collect_fxsave, but use XSAVE extended state.  */
00120 
00121 extern void i387_collect_xsave (const struct regcache *regcache,
00122                                 int regnum, void *xsave, int gcore);
00123 
00124 /* Prepare the FPU stack in REGCACHE for a function return.  */
00125 
00126 extern void i387_return_value (struct gdbarch *gdbarch,
00127                                struct regcache *regcache);
00128 
00129 #endif /* i387-tdep.h */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines