gdb/mips-tdep.h - gdb

Data types defined

Functions defined

Macros defined

Source code

  1. /* Target-dependent header for the MIPS architecture, for GDB, the GNU Debugger.

  2.    Copyright (C) 2002-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #ifndef MIPS_TDEP_H
  15. #define MIPS_TDEP_H

  16. #include "objfiles.h"

  17. struct gdbarch;

  18. /* All the possible MIPS ABIs.  */
  19. enum mips_abi
  20.   {
  21.     MIPS_ABI_UNKNOWN = 0,
  22.     MIPS_ABI_N32,
  23.     MIPS_ABI_O32,
  24.     MIPS_ABI_N64,
  25.     MIPS_ABI_O64,
  26.     MIPS_ABI_EABI32,
  27.     MIPS_ABI_EABI64,
  28.     MIPS_ABI_LAST
  29.   };

  30. /* Return the MIPS ABI associated with GDBARCH.  */
  31. enum mips_abi mips_abi (struct gdbarch *gdbarch);

  32. /* Base and compressed MIPS ISA variations.  */
  33. enum mips_isa
  34.   {
  35.     ISA_MIPS = -1,                /* mips_compression_string depends on it.  */
  36.     ISA_MIPS16,
  37.     ISA_MICROMIPS
  38.   };

  39. /* Corresponding MSYMBOL_TARGET_FLAG aliases.  */
  40. #define MSYMBOL_TARGET_FLAG_MIPS16 MSYMBOL_TARGET_FLAG_1
  41. #define MSYMBOL_TARGET_FLAG_MICROMIPS MSYMBOL_TARGET_FLAG_2

  42. /* Return the MIPS ISA's register size.  Just a short cut to the BFD
  43.    architecture's word size.  */
  44. extern int mips_isa_regsize (struct gdbarch *gdbarch);

  45. /* Return the current index for various MIPS registers.  */
  46. struct mips_regnum
  47. {
  48.   int pc;
  49.   int fp0;
  50.   int fp_implementation_revision;
  51.   int fp_control_status;
  52.   int badvaddr;                /* Bad vaddr for addressing exception.  */
  53.   int cause;                /* Describes last exception.  */
  54.   int hi;                /* Multiply/divide temp.  */
  55.   int lo;                /* ...  */
  56.   int dspacc;                /* SmartMIPS/DSP accumulators.  */
  57.   int dspctl;                /* DSP control.  */
  58. };
  59. extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch);

  60. /* Some MIPS boards don't support floating point while others only
  61.    support single-precision floating-point operations.  */

  62. enum mips_fpu_type
  63. {
  64.   MIPS_FPU_DOUBLE,                /* Full double precision floating point.  */
  65.   MIPS_FPU_SINGLE,                /* Single precision floating point (R4650).  */
  66.   MIPS_FPU_NONE                        /* No floating point.  */
  67. };

  68. /* MIPS specific per-architecture information.  */
  69. struct gdbarch_tdep
  70. {
  71.   /* from the elf header */
  72.   int elf_flags;

  73.   /* mips options */
  74.   enum mips_abi mips_abi;
  75.   enum mips_abi found_abi;
  76.   enum mips_isa mips_isa;
  77.   enum mips_fpu_type mips_fpu_type;
  78.   int mips_last_arg_regnum;
  79.   int mips_last_fp_arg_regnum;
  80.   int default_mask_address_p;
  81.   /* Is the target using 64-bit raw integer registers but only
  82.      storing a left-aligned 32-bit value in each?  */
  83.   int mips64_transfers_32bit_regs_p;
  84.   /* Indexes for various registers.  IRIX and embedded have
  85.      different values.  This contains the "public" fields.  Don't
  86.      add any that do not need to be public.  */
  87.   const struct mips_regnum *regnum;
  88.   /* Register names table for the current register set.  */
  89.   const char **mips_processor_reg_names;

  90.   /* The size of register data available from the target, if known.
  91.      This doesn't quite obsolete the manual
  92.      mips64_transfers_32bit_regs_p, since that is documented to force
  93.      left alignment even for big endian (very strange).  */
  94.   int register_size_valid_p;
  95.   int register_size;

  96.   /* Return the expected next PC if FRAME is stopped at a syscall
  97.      instruction.  */
  98.   CORE_ADDR (*syscall_next_pc) (struct frame_info *frame);
  99. };

  100. /* Register numbers of various important registers.  */

  101. enum
  102. {
  103.   MIPS_ZERO_REGNUM = 0,                /* Read-only register, always 0.  */
  104.   MIPS_AT_REGNUM = 1,
  105.   MIPS_V0_REGNUM = 2,                /* Function integer return value.  */
  106.   MIPS_A0_REGNUM = 4,                /* Loc of first arg during a subr call.  */
  107.   MIPS_S2_REGNUM = 18,                /* Contains return address in MIPS16 thunks. */
  108.   MIPS_T9_REGNUM = 25,                /* Contains address of callee in PIC.  */
  109.   MIPS_GP_REGNUM = 28,
  110.   MIPS_SP_REGNUM = 29,
  111.   MIPS_RA_REGNUM = 31,
  112.   MIPS_PS_REGNUM = 32,                /* Contains processor status.  */
  113.   MIPS_EMBED_LO_REGNUM = 33,
  114.   MIPS_EMBED_HI_REGNUM = 34,
  115.   MIPS_EMBED_BADVADDR_REGNUM = 35,
  116.   MIPS_EMBED_CAUSE_REGNUM = 36,
  117.   MIPS_EMBED_PC_REGNUM = 37,
  118.   MIPS_EMBED_FP0_REGNUM = 38,
  119.   MIPS_UNUSED_REGNUM = 73,        /* Never used, FIXME.  */
  120.   MIPS_FIRST_EMBED_REGNUM = 74,        /* First CP0 register for embedded use.  */
  121.   MIPS_PRID_REGNUM = 89,        /* Processor ID.  */
  122.   MIPS_LAST_EMBED_REGNUM = 89        /* Last one.  */
  123. };

  124. /* Defined in mips-tdep.c and used in remote-mips.c.  */
  125. extern void deprecated_mips_set_processor_regs_hack (void);

  126. /* Instruction sizes and other useful constants.  */
  127. enum
  128. {
  129.   MIPS_INSN16_SIZE = 2,
  130.   MIPS_INSN32_SIZE = 4,
  131.   /* The number of floating-point or integer registers.  */
  132.   MIPS_NUMREGS = 32
  133. };

  134. /* Single step based on where the current instruction will take us.  */
  135. extern int mips_software_single_step (struct frame_info *frame);

  136. /* Strip the ISA (compression) bit off from ADDR.  */
  137. extern CORE_ADDR mips_unmake_compact_addr (CORE_ADDR addr);

  138. /* Tell if the program counter value in MEMADDR is in a standard
  139.    MIPS function.  */
  140. extern int mips_pc_is_mips (bfd_vma memaddr);

  141. /* Tell if the program counter value in MEMADDR is in a MIPS16
  142.    function.  */
  143. extern int mips_pc_is_mips16 (struct gdbarch *gdbarch, bfd_vma memaddr);

  144. /* Tell if the program counter value in MEMADDR is in a microMIPS
  145.    function.  */
  146. extern int mips_pc_is_micromips (struct gdbarch *gdbarch, bfd_vma memaddr);

  147. /* Return the currently configured (or set) saved register size.  */
  148. extern unsigned int mips_abi_regsize (struct gdbarch *gdbarch);

  149. /* Make PC the address of the next instruction to execute.  */
  150. extern void mips_write_pc (struct regcache *regcache, CORE_ADDR pc);

  151. /* Target descriptions which only indicate the size of general
  152.    registers.  */
  153. extern struct target_desc *mips_tdesc_gp32;
  154. extern struct target_desc *mips_tdesc_gp64;

  155. /* Return non-zero if PC is in a MIPS SVR4 lazy binding stub section.  */

  156. static inline int
  157. in_mips_stubs_section (CORE_ADDR pc)
  158. {
  159.   return pc_in_section (pc, ".MIPS.stubs");
  160. }

  161. #endif /* MIPS_TDEP_H */