1e93f7393Sniklas /* Definitions to make GDB run on a mips box under 4.3bsd. 2b725ae77Skettenis 3b725ae77Skettenis Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 4b725ae77Skettenis 1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. 5b725ae77Skettenis 6e93f7393Sniklas Contributed by Per Bothner (bothner@cs.wisc.edu) at U.Wisconsin 7e93f7393Sniklas and by Alessandro Forin (af@cs.cmu.edu) at CMU.. 8e93f7393Sniklas 9e93f7393Sniklas This file is part of GDB. 10e93f7393Sniklas 11e93f7393Sniklas This program is free software; you can redistribute it and/or modify 12e93f7393Sniklas it under the terms of the GNU General Public License as published by 13e93f7393Sniklas the Free Software Foundation; either version 2 of the License, or 14e93f7393Sniklas (at your option) any later version. 15e93f7393Sniklas 16e93f7393Sniklas This program is distributed in the hope that it will be useful, 17e93f7393Sniklas but WITHOUT ANY WARRANTY; without even the implied warranty of 18e93f7393Sniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19e93f7393Sniklas GNU General Public License for more details. 20e93f7393Sniklas 21e93f7393Sniklas You should have received a copy of the GNU General Public License 22e93f7393Sniklas along with this program; if not, write to the Free Software 23b725ae77Skettenis Foundation, Inc., 59 Temple Place - Suite 330, 24b725ae77Skettenis Boston, MA 02111-1307, USA. */ 25e93f7393Sniklas 26e93f7393Sniklas #ifndef TM_MIPS_H 27e93f7393Sniklas #define TM_MIPS_H 1 28e93f7393Sniklas 29b725ae77Skettenis #include "regcache.h" 30b725ae77Skettenis 31e93f7393Sniklas struct frame_info; 32e93f7393Sniklas struct symbol; 33e93f7393Sniklas struct type; 34e93f7393Sniklas struct value; 35e93f7393Sniklas 36e93f7393Sniklas #include <bfd.h> 37e93f7393Sniklas #include "coff/sym.h" /* Needed for PDR below. */ 38e93f7393Sniklas #include "coff/symconst.h" 39e93f7393Sniklas 40e93f7393Sniklas /* Return non-zero if PC points to an instruction which will cause a step 41e93f7393Sniklas to execute both the instruction at PC and an instruction at PC+4. */ 42b725ae77Skettenis extern int mips_step_skips_delay (CORE_ADDR); 43b725ae77Skettenis #define STEP_SKIPS_DELAY_P (1) 44e93f7393Sniklas #define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc)) 45e93f7393Sniklas 46e93f7393Sniklas /* Register numbers of various important registers. 47e93f7393Sniklas Note that some of these values are "real" register numbers, 48e93f7393Sniklas and correspond to the general registers of the machine, 49e93f7393Sniklas and some are "phony" register numbers which are too large 50e93f7393Sniklas to be actual register numbers as far as the user is concerned 51e93f7393Sniklas but do serve to get the desired values when passed to read_register. */ 52e93f7393Sniklas 53e93f7393Sniklas #define ZERO_REGNUM 0 /* read-only register, always 0 */ 54e93f7393Sniklas #define V0_REGNUM 2 /* Function integer return value */ 55e93f7393Sniklas #define A0_REGNUM 4 /* Loc of first arg during a subr call */ 56b725ae77Skettenis #define T9_REGNUM 25 /* Contains address of callee in PIC */ 57e93f7393Sniklas #define RA_REGNUM 31 /* Contains return address value */ 58e93f7393Sniklas #define PS_REGNUM 32 /* Contains processor status */ 59e93f7393Sniklas #define UNUSED_REGNUM 73 /* Never used, FIXME */ 60e93f7393Sniklas #define FIRST_EMBED_REGNUM 74 /* First CP0 register for embedded use */ 61e93f7393Sniklas #define PRID_REGNUM 89 /* Processor ID */ 62e93f7393Sniklas #define LAST_EMBED_REGNUM 89 /* Last one */ 63e93f7393Sniklas 64e93f7393Sniklas /* Special symbol found in blocks associated with routines. We can hang 65e93f7393Sniklas mips_extra_func_info_t's off of this. */ 66e93f7393Sniklas 67e93f7393Sniklas #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__" 68b725ae77Skettenis extern void ecoff_relocate_efi (struct symbol *, CORE_ADDR); 69e93f7393Sniklas 70e93f7393Sniklas /* Specific information about a procedure. 71e93f7393Sniklas This overlays the MIPS's PDR records, 72e93f7393Sniklas mipsread.c (ab)uses this to save memory */ 73e93f7393Sniklas 74b725ae77Skettenis typedef struct mips_extra_func_info 75b725ae77Skettenis { 76e93f7393Sniklas long numargs; /* number of args to procedure (was iopt) */ 77e93f7393Sniklas bfd_vma high_addr; /* upper address bound */ 78b725ae77Skettenis long frame_adjust; /* offset of FP from SP (used on MIPS16) */ 79e93f7393Sniklas PDR pdr; /* Procedure descriptor record */ 80e93f7393Sniklas } 81b725ae77Skettenis *mips_extra_func_info_t; 82e93f7393Sniklas 83e93f7393Sniklas /* It takes two values to specify a frame on the MIPS. 84e93f7393Sniklas 85e93f7393Sniklas In fact, the *PC* is the primary value that sets up a frame. The 86e93f7393Sniklas PC is looked up to see what function it's in; symbol information 87e93f7393Sniklas from that function tells us which register is the frame pointer 88e93f7393Sniklas base, and what offset from there is the "virtual frame pointer". 89e93f7393Sniklas (This is usually an offset from SP.) On most non-MIPS machines, 90e93f7393Sniklas the primary value is the SP, and the PC, if needed, disambiguates 91e93f7393Sniklas multiple functions with the same SP. But on the MIPS we can't do 92e93f7393Sniklas that since the PC is not stored in the same part of the frame every 93e93f7393Sniklas time. This does not seem to be a very clever way to set up frames, 94b725ae77Skettenis but there is nothing we can do about that. */ 95e93f7393Sniklas 96e93f7393Sniklas #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv) 97b725ae77Skettenis extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *); 98e93f7393Sniklas 99b725ae77Skettenis /* Functions for dealing with MIPS16 call and return stubs. */ 100*63addd46Skettenis #define DEPRECATED_IGNORE_HELPER_CALL(pc) mips_ignore_helper (pc) 101b725ae77Skettenis extern int mips_ignore_helper (CORE_ADDR pc); 102e93f7393Sniklas 103b725ae77Skettenis /* Definitions and declarations used by mips-tdep.c and remote-mips.c */ 104b725ae77Skettenis #define MIPS_INSTLEN 4 /* Length of an instruction */ 105b725ae77Skettenis #define MIPS16_INSTLEN 2 /* Length of an instruction on MIPS16 */ 106b725ae77Skettenis #define MIPS_NUMREGS 32 /* Number of integer or float registers */ 107b725ae77Skettenis typedef unsigned long t_inst; /* Integer big enough to hold an instruction */ 108e93f7393Sniklas 109e93f7393Sniklas #endif /* TM_MIPS_H */ 110b725ae77Skettenis 111b725ae77Skettenis /* Single step based on where the current instruction will take us. */ 112b725ae77Skettenis extern void mips_software_single_step (enum target_signal, int); 113