2016-08-13 01:02:20 +08:00
|
|
|
/* Target dependent code for ARC arhitecture, for GDB.
|
|
|
|
|
2017-01-01 14:50:51 +08:00
|
|
|
Copyright 2005-2017 Free Software Foundation, Inc.
|
2016-08-13 01:02:20 +08:00
|
|
|
Contributed by Synopsys Inc.
|
|
|
|
|
|
|
|
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 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, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#ifndef ARC_TDEP_H
|
|
|
|
#define ARC_TDEP_H
|
|
|
|
|
|
|
|
/* Need disassemble_info. */
|
|
|
|
#include "dis-asm.h"
|
|
|
|
|
2017-02-10 19:11:46 +08:00
|
|
|
/* To simplify GDB code this enum assumes that internal regnums should be same
|
|
|
|
as architectural register numbers, i.e. PCL regnum is 63. This allows to
|
|
|
|
use internal GDB regnums as architectural numbers when dealing with
|
|
|
|
instruction encodings, for example when analyzing what are the registers
|
|
|
|
saved in function prologue. */
|
|
|
|
|
2016-08-13 01:02:20 +08:00
|
|
|
enum arc_regnum
|
|
|
|
{
|
|
|
|
/* Core registers. */
|
|
|
|
ARC_R0_REGNUM = 0,
|
|
|
|
ARC_FIRST_CORE_REGNUM = ARC_R0_REGNUM,
|
|
|
|
ARC_R1_REGNUM = 1,
|
|
|
|
ARC_R4_REGNUM = 4,
|
|
|
|
ARC_R7_REGNUM = 7,
|
|
|
|
ARC_R9_REGNUM = 9,
|
|
|
|
ARC_R13_REGNUM = 13,
|
|
|
|
ARC_R16_REGNUM = 16,
|
|
|
|
ARC_R25_REGNUM = 25,
|
|
|
|
/* Global data pointer. */
|
|
|
|
ARC_GP_REGNUM,
|
|
|
|
/* Frame pointer. */
|
|
|
|
ARC_FP_REGNUM,
|
|
|
|
/* Stack pointer. */
|
|
|
|
ARC_SP_REGNUM,
|
|
|
|
/* Return address from interrupt. */
|
|
|
|
ARC_ILINK_REGNUM,
|
|
|
|
ARC_R30_REGNUM,
|
|
|
|
/* Return address from function. */
|
|
|
|
ARC_BLINK_REGNUM,
|
|
|
|
/* Zero-delay loop counter. */
|
|
|
|
ARC_LP_COUNT_REGNUM = 60,
|
2017-02-10 19:11:46 +08:00
|
|
|
/* Reserved register number. There should never be a register with such
|
|
|
|
number, this name is needed only for a sanity check in
|
|
|
|
arc_cannot_(fetch|store)_register. */
|
|
|
|
ARC_RESERVED_REGNUM,
|
|
|
|
/* Long-immediate value. This is not a physical register - if instruction
|
|
|
|
has register 62 as an operand, then this operand is a literal value
|
|
|
|
stored in the instruction memory right after the instruction itself.
|
|
|
|
This value is required in this enumeration as an architectural number
|
|
|
|
for instruction analysis. */
|
|
|
|
ARC_LIMM_REGNUM,
|
2016-08-13 01:02:20 +08:00
|
|
|
/* Program counter, aligned to 4-bytes, read-only. */
|
|
|
|
ARC_PCL_REGNUM,
|
|
|
|
ARC_LAST_CORE_REGNUM = ARC_PCL_REGNUM,
|
|
|
|
/* AUX registers. */
|
|
|
|
/* Actual program counter. */
|
|
|
|
ARC_PC_REGNUM,
|
|
|
|
ARC_FIRST_AUX_REGNUM = ARC_PC_REGNUM,
|
|
|
|
/* Status register. */
|
|
|
|
ARC_STATUS32_REGNUM,
|
|
|
|
ARC_LAST_REGNUM = ARC_STATUS32_REGNUM,
|
|
|
|
ARC_LAST_AUX_REGNUM = ARC_STATUS32_REGNUM,
|
|
|
|
|
|
|
|
/* Additional ABI constants. */
|
|
|
|
ARC_FIRST_ARG_REGNUM = ARC_R0_REGNUM,
|
|
|
|
ARC_LAST_ARG_REGNUM = ARC_R7_REGNUM,
|
|
|
|
ARC_FIRST_CALLEE_SAVED_REGNUM = ARC_R13_REGNUM,
|
|
|
|
ARC_LAST_CALLEE_SAVED_REGNUM = ARC_R25_REGNUM,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Number of bytes in ARC register. All ARC registers are considered 32-bit.
|
|
|
|
Those registers, which are actually shorter has zero-on-read for extra bits.
|
|
|
|
Longer registers are represented as pairs of 32-bit registers. */
|
|
|
|
#define ARC_REGISTER_SIZE 4
|
|
|
|
|
|
|
|
#define arc_print(fmt, args...) fprintf_unfiltered (gdb_stdlog, fmt, ##args)
|
|
|
|
|
|
|
|
extern int arc_debug;
|
|
|
|
|
2016-10-12 19:36:44 +08:00
|
|
|
/* Target-dependent information. */
|
|
|
|
|
|
|
|
struct gdbarch_tdep
|
|
|
|
{
|
2016-10-12 19:36:44 +08:00
|
|
|
/* Offset to PC value in jump buffer. If this is negative, longjmp
|
|
|
|
support will be disabled. */
|
|
|
|
int jb_pc;
|
2016-10-12 19:36:44 +08:00
|
|
|
};
|
|
|
|
|
2016-08-13 01:02:20 +08:00
|
|
|
/* Utility functions used by other ARC-specific modules. */
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
arc_mach_is_arc600 (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
return (gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_arc_arc600
|
|
|
|
|| gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_arc_arc601);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
arc_mach_is_arc700 (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_arc_arc700;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
arc_mach_is_arcv2 (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_arc_arcv2;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* ARC_TDEP_H */
|