diff options
Diffstat (limited to 'gdb/arc-tdep.h')
-rw-r--r-- | gdb/arc-tdep.h | 213 |
1 files changed, 126 insertions, 87 deletions
diff --git a/gdb/arc-tdep.h b/gdb/arc-tdep.h index 4251eb4..8f33072 100644 --- a/gdb/arc-tdep.h +++ b/gdb/arc-tdep.h @@ -1,109 +1,148 @@ -/* Target dependent code for ARC700, for GDB, the GNU debugger. +/* Target dependent code for ARC processor family, for GDB, the GNU debugger. - Copyright 2005 Free Software Foundation, Inc. + Copyright 2005, 2008, 2009 Free Software Foundation, Inc. Contributed by Codito Technologies Pvt. Ltd. (www.codito.com) - Authors: - Soam Vasani <soam.vasani@codito.com> - Ramana Radhakrishnan <ramana.radhakrishnan@codito.com> + Authors: + Soam Vasani <soam.vasani@codito.com> + Ramana Radhakrishnan <ramana.radhakrishnan@codito.com> + Richard Stuckey <richard.stuckey@arc.com> 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 - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (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 - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -enum arc700_api_regnums - { - ARC_ARG0_REGNUM = 0, - ARC_ARG1_REGNUM = 1, - ARC_ARG2_REGNUM = 2, - ARC_ARG3_REGNUM = 3, - ARC_ARG4_REGNUM = 4, - ARC_ARG5_REGNUM = 5, - ARC_ARG6_REGNUM = 6, - ARC_ARG7_REGNUM = 7, - - /* When a return value is stored in registers, is in either r0 or in - (r1,r0). Used in arc_extract_return_value */ - ARC_RETURN1_REGNUM = 0, - ARC_RETURN2_REGNUM = 1 - }; - - - -enum ARCProcessorVersion - { - UNSUPPORTED, - ARCompact, - ARC600, - ARC700, - A5, - A4, - }; - - -enum ARCExtensionsSupportedInformation - { - ARC700_MMU - }; - - - -typedef struct ARCProcessorInformation -{ - enum ARCProcessorVersion arcprocessorversion; - enum ARCExtensionsSupportedInformation extensionsSupported; + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/******************************************************************************/ +/* */ +/* Outline: */ +/* This header file defines some target-dependent information which is */ +/* specific to the ARC gdb port. */ +/* */ +/******************************************************************************/ + +#ifndef ARC_TDEP_H +#define ARC_TDEP_H + +/* ARC header files */ +#include "arc-support.h" + + +#define ARC_PC_REGNUM (gdbarch_pc_regnum (current_gdbarch)) +#define ARC_NUM_REGS (gdbarch_num_regs (current_gdbarch)) +#define ARC_NUM_PSEUDO_REGS (gdbarch_num_pseudo_regs (current_gdbarch)) +#define ARC_TOTAL_REGS (ARC_NUM_REGS + ARC_NUM_PSEUDO_REGS) + + +#define ARC_MAX_CORE_REGS 64 +#define ARC_FIRST_EXTENSION_CORE_REGISTER 32 +#define ARC_LAST_EXTENSION_CORE_REGISTER 59 +#define ARC_NUM_EXTENSION_CORE_REGS (ARC_LAST_EXTENSION_CORE_REGISTER - ARC_FIRST_EXTENSION_CORE_REGISTER + 1) +#define ARC_NUM_STANDARD_CORE_REGS (ARC_MAX_CORE_REGS - ARC_NUM_EXTENSION_CORE_REGS) + + +#define IS_EXTENSION_CORE_REGISTER(hw_regnum) (ARC_FIRST_EXTENSION_CORE_REGISTER <= (hw_regnum) && (hw_regnum) <= ARC_LAST_EXTENSION_CORE_REGISTER) + + +/* ARC processor ABI-related registers: + R0 .. R7 are the registers used to pass arguments in function calls + R13 .. R26 are the callee-saved registers + when a return value is stored in registers it is in either R0 or in the pair (R0,R1). */ + +#define ARC_ABI_GLOBAL_POINTER 26 +#define ARC_ABI_FRAME_POINTER 27 +#define ARC_ABI_STACK_POINTER 28 -}ARCVariantsInfo; +#define ARC_ABI_FIRST_CALLEE_SAVED_REGISTER 13 +#define ARC_ABI_LAST_CALLEE_SAVED_REGISTER 26 + +#define ARC_ABI_FIRST_ARGUMENT_REGISTER 0 +#define ARC_ABI_LAST_ARGUMENT_REGISTER 7 +#define ARC_ABI_REGISTER_PARAMETER_SPACE ((ARC_ABI_LAST_ARGUMENT_REGISTER - ARC_ABI_FIRST_ARGUMENT_REGISTER + 1) * BYTES_IN_REGISTER) + +#define ARC_ABI_RETURN_REGNUM 0 +#define ARC_ABI_RETURN_LOW_REGNUM 0 +#define ARC_ABI_RETURN_HIGH_REGNUM 1 + +#define IS_ARGUMENT_REGISTER(hw_regnum) (ARC_ABI_FIRST_ARGUMENT_REGISTER <= (hw_regnum) && (hw_regnum) <= ARC_ABI_LAST_ARGUMENT_REGISTER) + + +/* This type is completed in the files arc-elf32-tdep.h and arc-linux-tdep.h, + as apppropriate for the arc-elf2 and arc-uclinux builds of gdb. */ +typedef struct arc_variant_info ARC_VariantsInfo; + + +#define REGISTER_NOT_PRESENT (-1) // special value for sc_reg_offset[reg] + + +/* N.B. this assumes that the host is little-endian! */ +#define HOST_AND_TARGET_ENDIANNESS_DIFFER(arch) (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG) + + +/* This structure holds target-dependent information. + + N.B. this type is used in the target-independent gdb code, but it is treated + as an opaque (or private) type: the only use of it is by pointers to + objects of this type (passed as parameters or returned as results, or + held in other structures); it is only the ARC-specific modules that + have knowledge of the structure of this type and access its fields. */ struct gdbarch_tdep { - /* Detect sigtramp. */ - int (*sigtramp_p) (struct frame_info *); - - /* Get address of sigcontext for sigtramp. */ - CORE_ADDR (*sigcontext_addr) (struct frame_info *); - - /* Offset of registers in `struct sigcontext'. */ - int *sc_reg_offset; - int sc_num_regs; - - /* In our linux target, gdbarch_pc_regnum points to stop_pc, which is a - register that's made-up by the kernel and does not actually exist. - stop_pc is NOT saved in the sigcontext; what is saved is the ret - "register". Since ret is a linux-only register, it's regnum is visible - only in arc-linux-tdep.c; hence initialize pc_regnum_in_sigcontext in - arc-linux-tdep.c. */ - int pc_regnum_in_sigcontext; - - /* Returns false, true, or -1; -1 means the tdep has nothing to say about this - register and group. */ - int (*register_reggroup_p) (int, struct reggroup *); - - /* Breakpoint instruction to be used */ - unsigned char * arc_breakpoint_insn; - int arc_breakpoint_size; - - /* For stopping backtraces. */ - CORE_ADDR lowest_pc; - - /* ARC Processor variant information. */ - ARCVariantsInfo * arc_processor_variant_info ; - + /* Detect sigtramp. */ + Boolean (*is_sigtramp) (struct frame_info*); + + /* Get address of sigcontext for sigtramp. */ + CORE_ADDR (*sigcontext_addr) (struct frame_info*); + + /* Offset of registers in `struct sigcontext'. */ + const int *sc_reg_offset; + unsigned int sc_num_regs; + + /* In our linux target, gdbarch_pc_regnum points to stop_pc, which is a + register that is made up by the kernel and does not actually exist. + stop_pc is NOT saved in the sigcontext; what is saved is the ret + "register". Since ret is a linux-only register, its regnum is visible + only in arc-linux-tdep.c; hence initialize pc_regnum_in_sigcontext in + arc-linux-tdep.c. */ + int pc_regnum_in_sigcontext; + + /* Returns 0, 1, or -1: + 0 means the register is not in the group. + 1 means the register is in the group. + -1 means the tdep has nothing to say about this register and group. */ + int (*register_reggroup_p) (int regnum, struct reggroup *group); + + /* Breakpoint instruction to be used. */ + const unsigned char *be_breakpoint_instruction; + const unsigned char *le_breakpoint_instruction; + unsigned int breakpoint_size; + + /* For stopping backtraces. */ + CORE_ADDR lowest_pc; + + /* ARC processor variant information (may be NULL). */ + ARC_VariantsInfo *processor_variant_info; }; -void arc_software_single_step(enum target_signal ignore, int insert_breakpoints_p); +/* Utility functions used by other ARC-specific modules. */ + +void arc_initialize_disassembler (struct disassemble_info *info); + +/* A global debug flag. */ +extern Boolean arc_debug_target; +#endif /* ARC_TDEP_H */ +/******************************************************************************/ |