GDB (API)
/home/stan/gdb/src/gdb/mips-tdep.h
Go to the documentation of this file.
00001 /* Target-dependent header for the MIPS architecture, for GDB, the GNU Debugger.
00002 
00003    Copyright (C) 2002-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 MIPS_TDEP_H
00021 #define MIPS_TDEP_H
00022 
00023 #include "objfiles.h"
00024 
00025 struct gdbarch;
00026 
00027 /* All the possible MIPS ABIs.  */
00028 enum mips_abi
00029   {
00030     MIPS_ABI_UNKNOWN = 0,
00031     MIPS_ABI_N32,
00032     MIPS_ABI_O32,
00033     MIPS_ABI_N64,
00034     MIPS_ABI_O64,
00035     MIPS_ABI_EABI32,
00036     MIPS_ABI_EABI64,
00037     MIPS_ABI_LAST
00038   };
00039 
00040 /* Return the MIPS ABI associated with GDBARCH.  */
00041 enum mips_abi mips_abi (struct gdbarch *gdbarch);
00042 
00043 /* Base and compressed MIPS ISA variations.  */
00044 enum mips_isa
00045   {
00046     ISA_MIPS = -1,              /* mips_compression_string depends on it.  */
00047     ISA_MIPS16,
00048     ISA_MICROMIPS
00049   };
00050 
00051 /* Return the MIPS ISA's register size.  Just a short cut to the BFD
00052    architecture's word size.  */
00053 extern int mips_isa_regsize (struct gdbarch *gdbarch);
00054 
00055 /* Return the current index for various MIPS registers.  */
00056 struct mips_regnum
00057 {
00058   int pc;
00059   int fp0;
00060   int fp_implementation_revision;
00061   int fp_control_status;
00062   int badvaddr;         /* Bad vaddr for addressing exception.  */
00063   int cause;            /* Describes last exception.  */
00064   int hi;               /* Multiply/divide temp.  */
00065   int lo;               /* ...  */
00066   int dspacc;           /* SmartMIPS/DSP accumulators.  */
00067   int dspctl;           /* DSP control.  */
00068 };
00069 extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch);
00070 
00071 /* Some MIPS boards don't support floating point while others only
00072    support single-precision floating-point operations.  */
00073 
00074 enum mips_fpu_type
00075 {
00076   MIPS_FPU_DOUBLE,              /* Full double precision floating point.  */
00077   MIPS_FPU_SINGLE,              /* Single precision floating point (R4650).  */
00078   MIPS_FPU_NONE                 /* No floating point.  */
00079 };
00080 
00081 /* MIPS specific per-architecture information.  */
00082 struct gdbarch_tdep
00083 {
00084   /* from the elf header */
00085   int elf_flags;
00086 
00087   /* mips options */
00088   enum mips_abi mips_abi;
00089   enum mips_abi found_abi;
00090   enum mips_isa mips_isa;
00091   enum mips_fpu_type mips_fpu_type;
00092   int mips_last_arg_regnum;
00093   int mips_last_fp_arg_regnum;
00094   int default_mask_address_p;
00095   /* Is the target using 64-bit raw integer registers but only
00096      storing a left-aligned 32-bit value in each?  */
00097   int mips64_transfers_32bit_regs_p;
00098   /* Indexes for various registers.  IRIX and embedded have
00099      different values.  This contains the "public" fields.  Don't
00100      add any that do not need to be public.  */
00101   const struct mips_regnum *regnum;
00102   /* Register names table for the current register set.  */
00103   const char **mips_processor_reg_names;
00104 
00105   /* The size of register data available from the target, if known.
00106      This doesn't quite obsolete the manual
00107      mips64_transfers_32bit_regs_p, since that is documented to force
00108      left alignment even for big endian (very strange).  */
00109   int register_size_valid_p;
00110   int register_size;
00111 
00112   /* General-purpose registers.  */
00113   struct regset *gregset;
00114   struct regset *gregset64;
00115 
00116   /* Floating-point registers.  */
00117   struct regset *fpregset;
00118   struct regset *fpregset64;
00119 
00120   /* Return the expected next PC if FRAME is stopped at a syscall
00121      instruction.  */
00122   CORE_ADDR (*syscall_next_pc) (struct frame_info *frame);
00123 };
00124 
00125 /* Register numbers of various important registers.  */
00126 
00127 enum
00128 {
00129   MIPS_ZERO_REGNUM = 0,         /* Read-only register, always 0.  */
00130   MIPS_AT_REGNUM = 1,
00131   MIPS_V0_REGNUM = 2,           /* Function integer return value.  */
00132   MIPS_A0_REGNUM = 4,           /* Loc of first arg during a subr call.  */
00133   MIPS_S2_REGNUM = 18,          /* Contains return address in MIPS16 thunks. */
00134   MIPS_T9_REGNUM = 25,          /* Contains address of callee in PIC.  */
00135   MIPS_GP_REGNUM = 28,
00136   MIPS_SP_REGNUM = 29,
00137   MIPS_RA_REGNUM = 31,
00138   MIPS_PS_REGNUM = 32,          /* Contains processor status.  */
00139   MIPS_EMBED_LO_REGNUM = 33,
00140   MIPS_EMBED_HI_REGNUM = 34,
00141   MIPS_EMBED_BADVADDR_REGNUM = 35,
00142   MIPS_EMBED_CAUSE_REGNUM = 36,
00143   MIPS_EMBED_PC_REGNUM = 37,
00144   MIPS_EMBED_FP0_REGNUM = 38,
00145   MIPS_UNUSED_REGNUM = 73,      /* Never used, FIXME.  */
00146   MIPS_FIRST_EMBED_REGNUM = 74, /* First CP0 register for embedded use.  */
00147   MIPS_PRID_REGNUM = 89,        /* Processor ID.  */
00148   MIPS_LAST_EMBED_REGNUM = 89   /* Last one.  */
00149 };
00150 
00151 /* Defined in mips-tdep.c and used in remote-mips.c.  */
00152 extern void deprecated_mips_set_processor_regs_hack (void);
00153 
00154 /* Instruction sizes and other useful constants.  */
00155 enum
00156 {
00157   MIPS_INSN16_SIZE = 2,
00158   MIPS_INSN32_SIZE = 4,
00159   /* The number of floating-point or integer registers.  */
00160   MIPS_NUMREGS = 32
00161 };
00162 
00163 /* Single step based on where the current instruction will take us.  */
00164 extern int mips_software_single_step (struct frame_info *frame);
00165 
00166 /* Tell if the program counter value in MEMADDR is in a standard
00167    MIPS function.  */
00168 extern int mips_pc_is_mips (bfd_vma memaddr);
00169 
00170 /* Tell if the program counter value in MEMADDR is in a MIPS16
00171    function.  */
00172 extern int mips_pc_is_mips16 (struct gdbarch *gdbarch, bfd_vma memaddr);
00173 
00174 /* Tell if the program counter value in MEMADDR is in a microMIPS
00175    function.  */
00176 extern int mips_pc_is_micromips (struct gdbarch *gdbarch, bfd_vma memaddr);
00177 
00178 /* Return the currently configured (or set) saved register size.  */
00179 extern unsigned int mips_abi_regsize (struct gdbarch *gdbarch);
00180 
00181 /* Make PC the address of the next instruction to execute.  */
00182 extern void mips_write_pc (struct regcache *regcache, CORE_ADDR pc);
00183 
00184 /* Target descriptions which only indicate the size of general
00185    registers.  */
00186 extern struct target_desc *mips_tdesc_gp32;
00187 extern struct target_desc *mips_tdesc_gp64;
00188 
00189 /* Return non-zero if PC is in a MIPS SVR4 lazy binding stub section.  */
00190 
00191 static inline int
00192 in_mips_stubs_section (CORE_ADDR pc)
00193 {
00194   return pc_in_section (pc, ".MIPS.stubs");
00195 }
00196 
00197 #endif /* MIPS_TDEP_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines