2002-12-05 05:17:39 +00:00
|
|
|
/* Target-dependent header for the MIPS architecture, for GDB, the GNU Debugger.
|
|
|
|
|
2012-01-04 08:17:56 +00:00
|
|
|
Copyright (C) 2002-2003, 2007-2012 Free Software Foundation, Inc.
|
2002-12-05 05:17:39 +00:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 18:08:50 +00:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-12-05 05:17:39 +00:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 18:08:50 +00:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2002-12-05 05:17:39 +00:00
|
|
|
|
|
|
|
#ifndef MIPS_TDEP_H
|
|
|
|
#define MIPS_TDEP_H
|
|
|
|
|
2003-04-12 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh: Add missing opaque declarations.
* gdbarch.h: Regnerate.
* symtab.h: Add missing opaque declarations.
* value.h, target.h, symfile.h, stabsread.h: Ditto.
* x86-64-tdep.h, xmodem.h, monitor.h, typeprint.h: Ditto.
* srec.h, solib-svr4.h, source.h, inferior.h: Ditto.
* ser-unix.h, serial.h, remote-utils.h, gdbcore.h: Ditto.
* ppc-tdep.h, ocd.h, mips-tdep.h, gdbtypes.h: Ditto.
* buildsym.h, builtin-regs.h, linespec.h, language.h: Ditto.
* i387-tdep.h, gdbthread.h, event-top.h, gdb.h: Ditto.
* dwarf2cfi.h, doublest.h, disasm.h, cp-abi.h: Ditto.
* cli-out.h, c-lang.h, ax-gdb.h, arch-utils.h: Ditto.
* ada-lang.h, config/nm-lynx.h, config/nm-linux.h: Ditto.
* config/sparc/tm-sp64.h, config/rs6000/tm-rs6000.h: Ditto.
* config/pa/tm-hppah.h, config/m68k/tm-delta68.h: Ditto.
* cli/cli-setshow.h, cli/cli-script.h: Ditto.
2003-04-12 17:41:26 +00:00
|
|
|
struct gdbarch;
|
|
|
|
|
2011-01-09 03:20:33 +00:00
|
|
|
/* All the possible MIPS ABIs. */
|
2002-12-05 05:17:39 +00:00
|
|
|
enum mips_abi
|
|
|
|
{
|
|
|
|
MIPS_ABI_UNKNOWN = 0,
|
|
|
|
MIPS_ABI_N32,
|
|
|
|
MIPS_ABI_O32,
|
|
|
|
MIPS_ABI_N64,
|
|
|
|
MIPS_ABI_O64,
|
|
|
|
MIPS_ABI_EABI32,
|
|
|
|
MIPS_ABI_EABI64,
|
|
|
|
MIPS_ABI_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Return the MIPS ABI associated with GDBARCH. */
|
|
|
|
enum mips_abi mips_abi (struct gdbarch *gdbarch);
|
|
|
|
|
2004-04-29 18:28:43 +00:00
|
|
|
/* Return the MIPS ISA's register size. Just a short cut to the BFD
|
2003-11-15 22:09:07 +00:00
|
|
|
architecture's word size. */
|
2004-04-29 18:28:43 +00:00
|
|
|
extern int mips_isa_regsize (struct gdbarch *gdbarch);
|
2003-11-15 22:09:07 +00:00
|
|
|
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-16 19:24:05 +00:00
|
|
|
/* Return the current index for various MIPS registers. */
|
|
|
|
struct mips_regnum
|
|
|
|
{
|
|
|
|
int pc;
|
|
|
|
int fp0;
|
|
|
|
int fp_implementation_revision;
|
|
|
|
int fp_control_status;
|
|
|
|
int badvaddr; /* Bad vaddr for addressing exception. */
|
|
|
|
int cause; /* Describes last exception. */
|
|
|
|
int hi; /* Multiply/divide temp. */
|
|
|
|
int lo; /* ... */
|
|
|
|
};
|
|
|
|
extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch);
|
|
|
|
|
2008-07-27 20:52:42 +00:00
|
|
|
/* Some MIPS boards don't support floating point while others only
|
|
|
|
support single-precision floating-point operations. */
|
|
|
|
|
|
|
|
enum mips_fpu_type
|
|
|
|
{
|
|
|
|
MIPS_FPU_DOUBLE, /* Full double precision floating point. */
|
|
|
|
MIPS_FPU_SINGLE, /* Single precision floating point (R4650). */
|
|
|
|
MIPS_FPU_NONE /* No floating point. */
|
|
|
|
};
|
|
|
|
|
2011-01-09 03:20:33 +00:00
|
|
|
/* MIPS specific per-architecture information. */
|
2008-07-27 20:52:42 +00:00
|
|
|
struct gdbarch_tdep
|
|
|
|
{
|
|
|
|
/* from the elf header */
|
|
|
|
int elf_flags;
|
|
|
|
|
|
|
|
/* mips options */
|
|
|
|
enum mips_abi mips_abi;
|
|
|
|
enum mips_abi found_abi;
|
|
|
|
enum mips_fpu_type mips_fpu_type;
|
|
|
|
int mips_last_arg_regnum;
|
|
|
|
int mips_last_fp_arg_regnum;
|
|
|
|
int default_mask_address_p;
|
|
|
|
/* Is the target using 64-bit raw integer registers but only
|
|
|
|
storing a left-aligned 32-bit value in each? */
|
|
|
|
int mips64_transfers_32bit_regs_p;
|
|
|
|
/* Indexes for various registers. IRIX and embedded have
|
|
|
|
different values. This contains the "public" fields. Don't
|
|
|
|
add any that do not need to be public. */
|
|
|
|
const struct mips_regnum *regnum;
|
|
|
|
/* Register names table for the current register set. */
|
|
|
|
const char **mips_processor_reg_names;
|
|
|
|
|
|
|
|
/* The size of register data available from the target, if known.
|
|
|
|
This doesn't quite obsolete the manual
|
|
|
|
mips64_transfers_32bit_regs_p, since that is documented to force
|
|
|
|
left alignment even for big endian (very strange). */
|
|
|
|
int register_size_valid_p;
|
|
|
|
int register_size;
|
|
|
|
|
2010-08-05 Hui Zhu <teawater@gmail.com>
* mips-linux-tdep.c(regset.h): New include.
(mips_supply_gregset_wrapper, mips_fill_gregset_wrapper,
mips_supply_fpregset_wrapper, mips_fill_fpregset_wrapper,
mips64_supply_gregset_wrapper, mips64_fill_gregset_wrapper,
mips64_supply_fpregset_wrapper, mips64_fill_fpregset_wrapper,
mips_linux_regset_from_core_section): New functions.
(fetch_core_registers, regset_core_fns): Deleted.
(mips_linux_init_abi): Add mips_linux_regset_from_core_section.
Deleted regset_core_fns.
* mips-tdep.c(mips_gdbarch_init): Initialize tdep->gregset,
tdep->gregset64, tdep->fpregset and tdep->fpregset64.
* mips-tdep.h(gdbarch_tdep): Add gregset, gregset64, fpregset
and fpregset64.
2010-08-05 03:03:36 +00:00
|
|
|
/* General-purpose registers. */
|
|
|
|
struct regset *gregset;
|
|
|
|
struct regset *gregset64;
|
|
|
|
|
|
|
|
/* Floating-point registers. */
|
|
|
|
struct regset *fpregset;
|
|
|
|
struct regset *fpregset64;
|
|
|
|
|
2008-07-27 20:52:42 +00:00
|
|
|
/* Return the expected next PC if FRAME is stopped at a syscall
|
|
|
|
instruction. */
|
|
|
|
CORE_ADDR (*syscall_next_pc) (struct frame_info *frame);
|
|
|
|
};
|
|
|
|
|
2007-05-13 12:48:40 +00:00
|
|
|
/* Register numbers of various important registers. */
|
2004-10-30 22:36:34 +00:00
|
|
|
|
2004-10-26 19:40:39 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-10-30 22:36:34 +00:00
|
|
|
MIPS_ZERO_REGNUM = 0, /* Read-only register, always 0. */
|
2004-10-26 19:40:39 +00:00
|
|
|
MIPS_AT_REGNUM = 1,
|
2004-10-30 22:36:34 +00:00
|
|
|
MIPS_V0_REGNUM = 2, /* Function integer return value. */
|
2011-01-09 03:20:33 +00:00
|
|
|
MIPS_A0_REGNUM = 4, /* Loc of first arg during a subr call. */
|
2004-10-30 22:36:34 +00:00
|
|
|
MIPS_T9_REGNUM = 25, /* Contains address of callee in PIC. */
|
2004-06-22 00:01:04 +00:00
|
|
|
MIPS_SP_REGNUM = 29,
|
2004-10-26 19:40:39 +00:00
|
|
|
MIPS_RA_REGNUM = 31,
|
2004-10-30 22:54:40 +00:00
|
|
|
MIPS_PS_REGNUM = 32, /* Contains processor status. */
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-16 19:24:05 +00:00
|
|
|
MIPS_EMBED_LO_REGNUM = 33,
|
|
|
|
MIPS_EMBED_HI_REGNUM = 34,
|
|
|
|
MIPS_EMBED_BADVADDR_REGNUM = 35,
|
|
|
|
MIPS_EMBED_CAUSE_REGNUM = 36,
|
|
|
|
MIPS_EMBED_PC_REGNUM = 37,
|
2004-10-30 22:36:34 +00:00
|
|
|
MIPS_EMBED_FP0_REGNUM = 38,
|
2011-01-09 03:20:33 +00:00
|
|
|
MIPS_UNUSED_REGNUM = 73, /* Never used, FIXME. */
|
2004-10-30 23:08:18 +00:00
|
|
|
MIPS_FIRST_EMBED_REGNUM = 74, /* First CP0 register for embedded use. */
|
2004-10-30 23:22:54 +00:00
|
|
|
MIPS_PRID_REGNUM = 89, /* Processor ID. */
|
2004-10-30 23:08:18 +00:00
|
|
|
MIPS_LAST_EMBED_REGNUM = 89 /* Last one. */
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-16 19:24:05 +00:00
|
|
|
};
|
|
|
|
|
2011-01-09 03:20:33 +00:00
|
|
|
/* Defined in mips-tdep.c and used in remote-mips.c. */
|
2003-11-16 22:46:49 +00:00
|
|
|
extern void deprecated_mips_set_processor_regs_hack (void);
|
|
|
|
|
2004-10-30 20:54:54 +00:00
|
|
|
/* Instruction sizes and other useful constants. */
|
|
|
|
enum
|
2004-10-26 19:40:39 +00:00
|
|
|
{
|
2004-10-30 20:54:54 +00:00
|
|
|
MIPS_INSN16_SIZE = 2,
|
|
|
|
MIPS_INSN32_SIZE = 4,
|
|
|
|
/* The number of floating-point or integer registers. */
|
|
|
|
MIPS_NUMREGS = 32
|
2004-10-26 19:40:39 +00:00
|
|
|
};
|
|
|
|
|
2004-10-26 14:13:24 +00:00
|
|
|
/* Single step based on where the current instruction will take us. */
|
2007-06-15 22:37:35 +00:00
|
|
|
extern int mips_software_single_step (struct frame_info *frame);
|
2003-11-16 22:46:49 +00:00
|
|
|
|
2004-10-30 17:53:47 +00:00
|
|
|
/* Tell if the program counter value in MEMADDR is in a MIPS16
|
|
|
|
function. */
|
|
|
|
extern int mips_pc_is_mips16 (bfd_vma memaddr);
|
|
|
|
|
2011-01-09 03:20:33 +00:00
|
|
|
/* Return the currently configured (or set) saved register size. */
|
2004-10-30 20:11:36 +00:00
|
|
|
extern unsigned int mips_abi_regsize (struct gdbarch *gdbarch);
|
|
|
|
|
2007-09-10 21:14:11 +00:00
|
|
|
/* Target descriptions which only indicate the size of general
|
|
|
|
registers. */
|
|
|
|
extern struct target_desc *mips_tdesc_gp32;
|
|
|
|
extern struct target_desc *mips_tdesc_gp64;
|
|
|
|
|
2002-12-05 05:17:39 +00:00
|
|
|
#endif /* MIPS_TDEP_H */
|