/* Definitions to target GDB to or1k targets.
|
/* Definitions to target GDB to or1k targets.
|
Copyright 2001 Free Software Foundation, Inc.
|
Copyright 2001 Free Software Foundation, Inc.
|
|
|
This file is part of GDB.
|
This file is part of GDB.
|
|
|
This program is free software; you can redistribute it and/or modify
|
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
|
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 2 of the License, or
|
(at your option) any later version.
|
(at your option) any later version.
|
|
|
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU General Public License for more details.
|
GNU General Public License for more details.
|
|
|
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
|
|
#ifndef TM_OR1K_H
|
#ifndef TM_OR1K_H
|
#define TM_OR1K_H
|
#define TM_OR1K_H
|
|
|
#ifndef TARGET_OR1K
|
#ifndef TARGET_OR1K
|
#define TARGET_OR1K
|
#define TARGET_OR1K
|
#endif
|
#endif
|
|
|
#include "defs.h"
|
#include "defs.h"
|
|
|
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
#include <inttypes.h> /* CZ */
|
#include <inttypes.h> /* CZ */
|
#endif /* __CYGWIN__ */
|
#endif /* __CYGWIN__ */
|
|
|
struct value;
|
struct value;
|
|
|
struct struct_or1k_implementation
|
struct struct_or1k_implementation
|
{
|
{
|
/* Implementation version. */
|
/* Implementation version. */
|
unsigned int VR;
|
unsigned int VR;
|
/* Units present. */
|
/* Units present. */
|
unsigned int UPR;
|
unsigned int UPR;
|
/* Number of total available matchpoints in this implementation. */
|
/* Number of total available matchpoints in this implementation. */
|
unsigned int num_matchpoints;
|
unsigned int num_matchpoints;
|
/* Number of currently used matchpoints. */
|
/* Number of currently used matchpoints. */
|
unsigned int num_used_matchpoints;
|
unsigned int num_used_matchpoints;
|
/* Has watchpoint driven counters. */
|
/* Has watchpoint driven counters. */
|
int has_counters;
|
int has_counters;
|
/* Number of registers. */
|
/* Number of registers. */
|
unsigned int num_gpr_regs;
|
unsigned int num_gpr_regs;
|
unsigned int num_vfpr_regs;
|
unsigned int num_vfpr_regs;
|
/* Is there any vf support? */
|
/* Is there any vf support? */
|
int vf_present;
|
int vf_present;
|
};
|
};
|
|
|
struct or1k_target_ops
|
struct or1k_target_ops
|
{
|
{
|
/* Name this target type. */
|
/* Name this target type. */
|
char *to_shortname;
|
char *to_shortname;
|
|
|
/* Init target. */
|
/* Init target. */
|
void (*to_init) PARAMS ((char *args));
|
void (*to_init) PARAMS ((char *args));
|
/* Destruct target. */
|
/* Destruct target. */
|
void (*to_done) PARAMS ((void));
|
void (*to_done) PARAMS ((void));
|
|
|
/* Read register.
|
/* Read register.
|
Does not fail, places error no. in err instead or call error(), if fatal. */
|
Does not fail, places error no. in err instead or call error(), if fatal. */
|
ULONGEST (*to_read_reg) PARAMS ((unsigned int regno));
|
ULONGEST (*to_read_reg) PARAMS ((unsigned int regno));
|
/* Write register.
|
/* Write register.
|
Does not fail, places error no. in err instead or call error(), if fatal. */
|
Does not fail, places error no. in err instead or call error(), if fatal. */
|
void (*to_write_reg) PARAMS ((unsigned int regno, ULONGEST value));
|
void (*to_write_reg) PARAMS ((unsigned int regno, ULONGEST value));
|
|
|
/* Read a block...possibly more efficient than several isolated
|
/* Read a block...possibly more efficient than several isolated
|
call to read_reg...worst case the same efficiency. Returns 0
|
call to read_reg...worst case the same efficiency. Returns 0
|
on success or errno if a failure occurred. */
|
on success or errno if a failure occurred. */
|
int (*to_read_block) PARAMS ((unsigned int regno, void* block, int nRegisters));
|
int (*to_read_block) PARAMS ((unsigned int regno, void* block, int nRegisters));
|
|
|
/* Write a block...possibly more efficient than several isolated
|
/* Write a block...possibly more efficient than several isolated
|
call to write_reg...worst case the same efficiency. Returns 0
|
call to write_reg...worst case the same efficiency. Returns 0
|
on success or errno if a failure occurred. */
|
on success or errno if a failure occurred. */
|
int (*to_write_block) PARAMS ((unsigned int regno, void* block, int nRegisters));
|
int (*to_write_block) PARAMS ((unsigned int regno, void* block, int nRegisters));
|
|
|
/* Selects scan chain. All register accesses are related to current scan chain.
|
/* Selects scan chain. All register accesses are related to current scan chain.
|
Does not fail, places error no. in err instead or call error(), if fatal.
|
Does not fail, places error no. in err instead or call error(), if fatal.
|
See jtag_chains enum. */
|
See jtag_chains enum. */
|
void (*to_set_chain) PARAMS ((int chain));
|
void (*to_set_chain) PARAMS ((int chain));
|
|
|
/* Executes extended command on the target. */
|
/* Executes extended command on the target. */
|
void (*to_exec_command) PARAMS ((char *args, int from_tty));
|
void (*to_exec_command) PARAMS ((char *args, int from_tty));
|
|
|
/* Associated target_ops. */
|
/* Associated target_ops. */
|
struct target_ops *gdb_ops;
|
struct target_ops *gdb_ops;
|
/* Should be OPS_MAGIC. */
|
/* Should be OPS_MAGIC. */
|
int to_magic;
|
int to_magic;
|
};
|
};
|
|
|
|
|
#define DEFAULT_PROMPT "(gdb) "
|
#define DEFAULT_PROMPT "(gdb) "
|
|
|
/* Context stuff. */
|
/* Context stuff. */
|
#define CURRENT_CID (0)
|
#define CURRENT_CID (0)
|
#define MAX_CID (15)
|
#define MAX_CID (15)
|
|
|
|
|
/* Instruction definitions. */
|
/* Instruction definitions. */
|
#define BRK_INSTR_STRUCT {0x21, 0x00, 0x00, 0x01}
|
#define BRK_INSTR_STRUCT {0x21, 0x00, 0x00, 0x01}
|
#define NOP_INSTR (0x15000000)
|
#define NOP_INSTR (0x15000000)
|
|
|
/* Special purpose regisers. */
|
/* Special purpose regisers. */
|
#define SPR_GROUP_SIZE_BITS (11)
|
#define SPR_GROUP_SIZE_BITS (11)
|
#define SPR_GROUP_SIZE (1 << SPR_GROUP_SIZE_BITS)
|
#define SPR_GROUP_SIZE (1 << SPR_GROUP_SIZE_BITS)
|
#define SPR_SYSTEM_GROUP (0)
|
#define SPR_SYSTEM_GROUP (0)
|
#define SPR_DEBUG_GROUP (6)
|
#define SPR_DEBUG_GROUP (6)
|
#define SPR_GPR_START (1024)
|
#define SPR_GPR_START (1024)
|
#define SPR_VFPR_START ((MAX_CID + 1) * MAX_GPR_REGS + SPR_GPR_START)
|
#define SPR_VFPR_START ((MAX_CID + 1) * MAX_GPR_REGS + SPR_GPR_START)
|
#define OR1K_NUM_SPR_GROUPS (12)
|
#define OR1K_NUM_SPR_GROUPS (12)
|
|
|
/* Define register values. */
|
/* Define register values. */
|
#define SPR_REG(group, index) (((group) << SPR_GROUP_SIZE_BITS) + (index))
|
#define SPR_REG(group, index) (((group) << SPR_GROUP_SIZE_BITS) + (index))
|
|
|
#define VR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 0)
|
#define VR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 0)
|
#define UPR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 1)
|
#define UPR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 1)
|
#define CPUCFGR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 2)
|
#define CPUCFGR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 2)
|
#define DCFGR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 7)
|
#define DCFGR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 7)
|
#define PC_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 16)
|
#define PC_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 16)
|
#define SR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 17)
|
#define SR_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 17)
|
#define PPC_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 18)
|
#define PPC_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 18)
|
#define CCR_SPRNUM(cid) SPR_REG(SPR_SYSTEM_GROUP, 4 + (cid))
|
#define CCR_SPRNUM(cid) SPR_REG(SPR_SYSTEM_GROUP, 4 + (cid))
|
#define EPCR_SPRNUM(cid) SPR_REG(SPR_SYSTEM_GROUP, 32 + (cid))
|
#define EPCR_SPRNUM(cid) SPR_REG(SPR_SYSTEM_GROUP, 32 + (cid))
|
#define EPCR0_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 32)
|
#define EPCR0_SPRNUM SPR_REG(SPR_SYSTEM_GROUP, 32)
|
|
|
#define DVR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
|
#define DVR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
|
#define DCR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
|
#define DCR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
|
#define DMR1_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 16)
|
#define DMR1_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 16)
|
#define DMR2_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 17)
|
#define DMR2_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 17)
|
#define DCWR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
|
#define DCWR0_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
|
#define DCWR1_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
|
#define DCWR1_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 0xee)
|
#define DSR_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 20)
|
#define DSR_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 20)
|
#define DRR_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 21)
|
#define DRR_SPRNUM SPR_REG(SPR_DEBUG_GROUP, 21)
|
|
|
#define ZERO_REGNUM (0)
|
#define ZERO_REGNUM (0)
|
#define SP_REGNUM (1)
|
#define SP_REGNUM (1)
|
#define FP_REGNUM (2)
|
#define FP_REGNUM (2)
|
#define A0_REGNUM (3)
|
#define A0_REGNUM (3)
|
#define A5_REGNUM (8)
|
#define A5_REGNUM (8)
|
#define LR_REGNUM (9)
|
#define LR_REGNUM (9)
|
#define RV_REGNUM (11)
|
#define RV_REGNUM (11)
|
#define VFA0_REGNUM (MAX_GPR_REGS + 0)
|
#define VFA0_REGNUM (MAX_GPR_REGS + 0)
|
#define VFA5_REGNUM (MAX_GPR_REGS + 5)
|
#define VFA5_REGNUM (MAX_GPR_REGS + 5)
|
#define VFRV_REGNUM (MAX_GPR_REGS + 6)
|
#define VFRV_REGNUM (MAX_GPR_REGS + 6)
|
#define PC_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 0)
|
#define PC_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 0)
|
#define PS_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 1)
|
#define PS_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 1)
|
#define EPCR_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 2)
|
#define EPCR_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 2)
|
#define CCR_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 2)
|
#define CCR_REGNUM (MAX_GPR_REGS + MAX_VF_REGS + 2)
|
|
|
/******** END OF ADDITIONS BY CZ ************/
|
/******** END OF ADDITIONS BY CZ ************/
|
|
|
extern int or1k_regnum_to_sprnum PARAMS ((int regno));
|
extern int or1k_regnum_to_sprnum PARAMS ((int regno));
|
#define REGNUM_TO_SPRNUM(regno) (or1k_regnum_to_sprnum(regno))
|
#define REGNUM_TO_SPRNUM(regno) (or1k_regnum_to_sprnum(regno))
|
|
|
/* Defines for SPR bits. */
|
/* Defines for SPR bits. */
|
#define DMR1_ST (0x00400000)
|
#define DMR1_ST (0x00400000)
|
|
|
/* Changed by CZ 21/06/01 */
|
/* Changed by CZ 21/06/01 */
|
#define DRR_TE (0x00002000)
|
#define DRR_TE (0x00002000)
|
#define DRR_SSE (0x00001000)
|
#define DRR_SSE (0x00001000)
|
#define DRR_SCE (0x00000800)
|
#define DRR_SCE (0x00000800)
|
#define DRR_RE (0x00000400)
|
#define DRR_RE (0x00000400)
|
#define DRR_IME (0x00000200)
|
#define DRR_IME (0x00000200)
|
#define DRR_DME (0x00000100)
|
#define DRR_DME (0x00000100)
|
#define DRR_HPINTE (0x00000080)
|
#define DRR_HPINTE (0x00000080)
|
#define DRR_IIE (0x00000040)
|
#define DRR_IIE (0x00000040)
|
#define DRR_AE (0x00000020)
|
#define DRR_AE (0x00000020)
|
#define DRR_LPINTE (0x00000010)
|
#define DRR_LPINTE (0x00000010)
|
#define DRR_IPFE (0x00000008)
|
#define DRR_IPFE (0x00000008)
|
#define DRR_DPFE (0x00000004)
|
#define DRR_DPFE (0x00000004)
|
#define DRR_BUSEE (0x00000002)
|
#define DRR_BUSEE (0x00000002)
|
#define DRR_RSTE (0x00000001)
|
#define DRR_RSTE (0x00000001)
|
|
|
/* Number of matchpoints */
|
/* Number of matchpoints */
|
#define NUM_MATCHPOINTS (or1k_implementation.num_matchpoints)
|
#define NUM_MATCHPOINTS (or1k_implementation.num_matchpoints)
|
#define MAX_MATCHPOINTS (8)
|
#define MAX_MATCHPOINTS (8)
|
|
|
/* Number of machine GPR registers */
|
/* Number of machine GPR registers */
|
#define NUM_GPR_REGS (or1k_implementation.num_gpr_regs)
|
#define NUM_GPR_REGS (or1k_implementation.num_gpr_regs)
|
#define MAX_GPR_REGS (32)
|
#define MAX_GPR_REGS (32)
|
|
|
/* Number of machine VF registers */
|
/* Number of machine VF registers */
|
#define NUM_VF_REGS (or1k_implementation.num_vfpr_regs)
|
#define NUM_VF_REGS (or1k_implementation.num_vfpr_regs)
|
#define MAX_VF_REGS (32)
|
#define MAX_VF_REGS (32)
|
|
|
/* gdb mapping of registers */
|
/* gdb mapping of registers */
|
#ifndef NUM_REGS
|
#ifndef NUM_REGS
|
#define NUM_REGS (MAX_GPR_REGS+MAX_VF_REGS+3)
|
#define NUM_REGS (MAX_GPR_REGS+MAX_VF_REGS+3)
|
#endif
|
#endif
|
|
|
/* Can act like a little or big endian. */
|
/* Can act like a little or big endian. */
|
#if !defined (TARGET_BYTE_ORDER_DEFAULT)
|
#if !defined (TARGET_BYTE_ORDER_DEFAULT)
|
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
|
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
|
#define TARGET_BYTE_ORDER_SELECTABLE_P (1)
|
#define TARGET_BYTE_ORDER_SELECTABLE_P (1)
|
#endif
|
#endif
|
|
|
/* Size (in bytes) of registers. */
|
/* Size (in bytes) of registers. */
|
#define OR1K_SPR_REGSIZE (4)
|
#define OR1K_SPR_REGSIZE (4)
|
#define OR1K_VF_REGSIZE (8)
|
#define OR1K_VF_REGSIZE (8)
|
#define OR1K_GPR_REGSIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
|
#define OR1K_GPR_REGSIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
|
#define OR1K_VF_DOUBLE (0)
|
#define OR1K_VF_DOUBLE (0)
|
|
|
#define OR1K_IS_GPR(N) ((N) >= 0 && (N) < MAX_GPR_REGS)
|
#define OR1K_IS_GPR(N) ((N) >= 0 && (N) < MAX_GPR_REGS)
|
#define OR1K_IS_VF(N) ((N) >= MAX_GPR_REGS && (N) < MAX_GPR_REGS + MAX_VF_REGS)
|
#define OR1K_IS_VF(N) ((N) >= MAX_GPR_REGS && (N) < MAX_GPR_REGS + MAX_VF_REGS)
|
|
|
/* Register representation is the same as in memory. */
|
/* Register representation is the same as in memory. */
|
#define REGISTER_CONVERTIBLE(N) (0)
|
#define REGISTER_CONVERTIBLE(N) (0)
|
|
|
/* Given the register index, return the name of the corresponding
|
/* Given the register index, return the name of the corresponding
|
register. */
|
register. */
|
extern char *or1k_register_name PARAMS ((int regno));
|
extern char *or1k_register_name PARAMS ((int regno));
|
#define REGISTER_NAME(regno) or1k_register_name (regno)
|
#define REGISTER_NAME(regno) or1k_register_name (regno)
|
|
|
/* Is this implementation 64 or 32 bit.
|
/* Is this implementation 64 or 32 bit.
|
WARNING: gdb or1k port is not yet prepared for 64b implementations! */
|
WARNING: gdb or1k port is not yet prepared for 64b implementations! */
|
#define OR1K_64BIT_IMPLEMENTATION 0
|
#define OR1K_64BIT_IMPLEMENTATION 0
|
|
|
/* Number of bytes of storage in the actual machine representation for
|
/* Number of bytes of storage in the actual machine representation for
|
register N. NOTE: This indirectly defines the register size
|
register N. NOTE: This indirectly defines the register size
|
transfered by the GDB protocol. If we have 64bit processor
|
transfered by the GDB protocol. If we have 64bit processor
|
implementation, GPR register raw size is 8B, otherwise 4B. */
|
implementation, GPR register raw size is 8B, otherwise 4B. */
|
#define REGISTER_RAW_SIZE(N) or1k_register_raw_size(N)
|
#define REGISTER_RAW_SIZE(N) or1k_register_raw_size(N)
|
extern int or1k_register_raw_size PARAMS ((int regnum));
|
extern int or1k_register_raw_size PARAMS ((int regnum));
|
|
|
/* Number of bytes of storage in the program's representation
|
/* Number of bytes of storage in the program's representation
|
for register N. Same as RAW_SIZE. */
|
for register N. Same as RAW_SIZE. */
|
#define REGISTER_VIRTUAL_SIZE(N) TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (N))
|
#define REGISTER_VIRTUAL_SIZE(N) TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (N))
|
|
|
/* Return the GDB type object for the "standard" data type of data in
|
/* Return the GDB type object for the "standard" data type of data in
|
register N. */
|
register N. */
|
#define REGISTER_VIRTUAL_TYPE(N) ((OR1K_IS_GPR(N))?(\
|
#define REGISTER_VIRTUAL_TYPE(N) ((OR1K_IS_GPR(N))?(\
|
(OR1K_64BIT_IMPLEMENTATION)?builtin_type_int64:builtin_type_int\
|
(OR1K_64BIT_IMPLEMENTATION)?builtin_type_int64:builtin_type_int\
|
):(OR1K_IS_VF(N) ? builtin_type_float : builtin_type_uint32))
|
):(OR1K_IS_VF(N) ? builtin_type_float : builtin_type_uint32))
|
|
|
/* Largest value REGISTER_RAW_SIZE can have. */
|
/* Largest value REGISTER_RAW_SIZE can have. */
|
#define MAX_REGISTER_RAW_SIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
|
#define MAX_REGISTER_RAW_SIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
|
|
|
/* Largest value REGISTER_VIRTUAL_SIZE can have. */
|
/* Largest value REGISTER_VIRTUAL_SIZE can have. */
|
#define MAX_REGISTER_VIRTUAL_SIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
|
#define MAX_REGISTER_VIRTUAL_SIZE ((OR1K_64BIT_IMPLEMENTATION)?(8):(4))
|
|
|
#define REGISTER_SIZE (MAX_REGISTER_VIRTUAL_SIZE)
|
#define REGISTER_SIZE (MAX_REGISTER_VIRTUAL_SIZE)
|
|
|
/* ABI uses R3 through R8 for args. */
|
/* ABI uses R3 through R8 for args. */
|
#define OR1K_LAST_ARG_REGNUM (A5_REGNUM)
|
#define OR1K_LAST_ARG_REGNUM (A5_REGNUM)
|
#define OR1K_NUM_ARG_REGS (6)
|
#define OR1K_NUM_ARG_REGS (6)
|
|
|
/* ABI uses VFR0 through VFR5 for float args. */
|
/* ABI uses VFR0 through VFR5 for float args. */
|
#define OR1K_LAST_FP_ARG_REGNUM (VFA5_REGNUM)
|
#define OR1K_LAST_FP_ARG_REGNUM (VFA5_REGNUM)
|
#define OR1K_NUM_FP_ARG_REGS (6)
|
#define OR1K_NUM_FP_ARG_REGS (6)
|
|
|
/* Should not store into R0. */
|
/* Should not store into R0. */
|
#define CANNOT_STORE_REGISTER(N) ((N) == 0)
|
#define CANNOT_STORE_REGISTER(N) ((N) == 0)
|
|
|
/* Index within `registers' of the first byte of the space for
|
/* Index within `registers' of the first byte of the space for
|
register N. */
|
register N. */
|
#define REGISTER_BYTE(N) or1k_register_byte(N)
|
#define REGISTER_BYTE(N) or1k_register_byte(N)
|
extern int or1k_register_byte PARAMS ((int regnum));
|
extern int or1k_register_byte PARAMS ((int regnum));
|
|
|
/* Total amount of space needed to store our copies of the machine's
|
/* Total amount of space needed to store our copies of the machine's
|
register state, the array `registers'. */
|
register state, the array `registers'. */
|
#define REGISTER_BYTES ((NUM_GPR_REGS * OR1K_GPR_REGSIZE) + \
|
#define REGISTER_BYTES ((NUM_GPR_REGS * OR1K_GPR_REGSIZE) + \
|
(NUM_VF_REGS * OR1K_VF_REGSIZE) + \
|
(NUM_VF_REGS * OR1K_VF_REGSIZE) + \
|
(3 * OR1K_SPR_REGSIZE ))
|
(3 * OR1K_SPR_REGSIZE ))
|
|
|
extern void or1k_do_registers_info PARAMS ((int, int));
|
extern void or1k_do_registers_info PARAMS ((int, int));
|
#define DO_REGISTERS_INFO(regnum, fp) or1k_do_registers_info(regnum, fp)
|
#define DO_REGISTERS_INFO(regnum, fp) or1k_do_registers_info(regnum, fp)
|
|
|
|
|
|
|
/* BREAKPOINT_FROM_PC uses the program counter value to determine whether a
|
/* BREAKPOINT_FROM_PC uses the program counter value to determine whether a
|
16- or 32-bit breakpoint should be used. It returns a pointer
|
16- or 32-bit breakpoint should be used. It returns a pointer
|
to a string of bytes that encode a breakpoint instruction, stores
|
to a string of bytes that encode a breakpoint instruction, stores
|
the length of the string to *lenptr, and adjusts the pc (if necessary) to
|
the length of the string to *lenptr, and adjusts the pc (if necessary) to
|
point to the actual memory location where the breakpoint should be
|
point to the actual memory location where the breakpoint should be
|
inserted. */
|
inserted. */
|
extern unsigned char *or1k_breakpoint_from_pc PARAMS ((CORE_ADDR *bp_addr, int *bp_size));
|
extern unsigned char *or1k_breakpoint_from_pc PARAMS ((CORE_ADDR *bp_addr, int *bp_size));
|
#define BREAKPOINT_FROM_PC(pcptr, lenptr) or1k_breakpoint_from_pc (pcptr, lenptr)
|
#define BREAKPOINT_FROM_PC(pcptr, lenptr) or1k_breakpoint_from_pc (pcptr, lenptr)
|
|
|
/* Amount PC must be decremented by after a breakpoint.
|
/* Amount PC must be decremented by after a breakpoint.
|
This is often the number of bytes in BREAKPOINT
|
This is often the number of bytes in BREAKPOINT
|
but not always. */
|
but not always. */
|
|
|
#define DECR_PC_AFTER_BREAK 0
|
#define DECR_PC_AFTER_BREAK 0
|
|
|
/* Don't step over l.trap */
|
/* Don't step over l.trap */
|
#define CANNOT_STEP_BREAKPOINT
|
#define CANNOT_STEP_BREAKPOINT
|
|
|
extern int or1k_insert_breakpoint (CORE_ADDR addr, char *contents_cache);
|
extern int or1k_insert_breakpoint (CORE_ADDR addr, char *contents_cache);
|
#define target_insert_hw_breakpoint(addr, cache) or1k_insert_breakpoint (addr, cache)
|
#define target_insert_hw_breakpoint(addr, cache) or1k_insert_breakpoint (addr, cache)
|
|
|
extern int or1k_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
|
extern int or1k_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
|
#define target_remove_hw_breakpoint(addr, cache) or1k_remove_breakpoint (addr, cache)
|
#define target_remove_hw_breakpoint(addr, cache) or1k_remove_breakpoint (addr, cache)
|
|
|
/* Watchpoint support. */
|
/* Watchpoint support. */
|
#define TARGET_HAS_HARDWARE_WATCHPOINTS
|
#define TARGET_HAS_HARDWARE_WATCHPOINTS
|
|
|
/* Use these macros for watchpoint insertion/deletion. */
|
/* Use these macros for watchpoint insertion/deletion. */
|
/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
|
/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
|
extern int or1k_insert_watchpoint PARAMS ((CORE_ADDR addr, int len, int type));
|
extern int or1k_insert_watchpoint PARAMS ((CORE_ADDR addr, int len, int type));
|
#define target_insert_watchpoint(addr, len, type) \
|
#define target_insert_watchpoint(addr, len, type) \
|
or1k_insert_watchpoint (addr, len, type)
|
or1k_insert_watchpoint (addr, len, type)
|
|
|
extern int or1k_insert_watchpoint PARAMS ((CORE_ADDR addr, int len, int type));
|
extern int or1k_insert_watchpoint PARAMS ((CORE_ADDR addr, int len, int type));
|
#define target_remove_watchpoint(addr, len, type) \
|
#define target_remove_watchpoint(addr, len, type) \
|
or1k_remove_watchpoint (addr, len, type)
|
or1k_remove_watchpoint (addr, len, type)
|
|
|
/* We need to remove watchpoints when stepping, else we hit them again! */
|
/* We need to remove watchpoints when stepping, else we hit them again! */
|
#define HAVE_NONSTEPPABLE_WATCHPOINT
|
#define HAVE_NONSTEPPABLE_WATCHPOINT
|
|
|
extern int or1k_stopped_by_watchpoint PARAMS ((void));
|
extern int or1k_stopped_by_watchpoint PARAMS ((void));
|
#define STOPPED_BY_WATCHPOINT(w) or1k_stopped_by_watchpoint ()
|
#define STOPPED_BY_WATCHPOINT(w) or1k_stopped_by_watchpoint ()
|
|
|
typedef enum bptype bptype;
|
typedef enum bptype bptype;
|
extern int or1k_can_use_hardware_watchpoint PARAMS ((enum bptype, int));
|
extern int or1k_can_use_hardware_watchpoint PARAMS ((enum bptype, int));
|
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(bp_type, cnt, ot) \
|
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(bp_type, cnt, ot) \
|
or1k_can_use_hardware_watchpoint(bp_type, cnt)
|
or1k_can_use_hardware_watchpoint(bp_type, cnt)
|
|
|
|
|
/* Catchpoint support. */
|
/* Catchpoint support. */
|
/* HACK: how do we hook to signal namings otherwise? */
|
/* HACK: how do we hook to signal namings otherwise? */
|
#include "target.h"
|
#include "target.h"
|
extern char *target_signal_to_string PARAMS ((enum target_signal));
|
extern char *target_signal_to_string PARAMS ((enum target_signal));
|
|
|
/* Return the name (SIGHUP, etc.) for a signal. */
|
/* Return the name (SIGHUP, etc.) for a signal. */
|
extern char *or1k_signal_to_name PARAMS ((enum target_signal));
|
extern char *or1k_signal_to_name PARAMS ((enum target_signal));
|
|
|
/* Given a name (SIGHUP, etc.), return its signal. */
|
/* Given a name (SIGHUP, etc.), return its signal. */
|
extern enum target_signal or1k_signal_from_name PARAMS ((char *));
|
extern enum target_signal or1k_signal_from_name PARAMS ((char *));
|
|
|
#define NUM_OR1K_SIGNALS (14)
|
#define NUM_OR1K_SIGNALS (14)
|
|
|
/* Extract from an array REGBUF containing the (raw) register state
|
/* Extract from an array REGBUF containing the (raw) register state
|
a function return value of type TYPE, and copy that, in virtual format,
|
a function return value of type TYPE, and copy that, in virtual format,
|
into VALBUF. */
|
into VALBUF. */
|
extern void or1k_extract_return_value PARAMS ((struct type *, char[], char *));
|
extern void or1k_extract_return_value PARAMS ((struct type *, char[], char *));
|
#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
|
#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
|
or1k_extract_return_value (TYPE, REGBUF, VALBUF)
|
or1k_extract_return_value (TYPE, REGBUF, VALBUF)
|
|
|
/* Write into appropriate registers a function return value
|
/* Write into appropriate registers a function return value
|
of type TYPE, given in virtual format. */
|
of type TYPE, given in virtual format. */
|
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
|
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
|
{\
|
{\
|
if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)\
|
if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)\
|
write_register_bytes (REGISTER_BYTE (VFRV_REGNUM), VALBUF, TYPE_LENGTH (TYPE));\
|
write_register_bytes (REGISTER_BYTE (VFRV_REGNUM), VALBUF, TYPE_LENGTH (TYPE));\
|
else\
|
else\
|
write_register_bytes (REGISTER_BYTE (RV_REGNUM), VALBUF, TYPE_LENGTH (TYPE));\
|
write_register_bytes (REGISTER_BYTE (RV_REGNUM), VALBUF, TYPE_LENGTH (TYPE));\
|
}
|
}
|
|
|
/* Extract from an array REGBUF containing the (raw) register state
|
/* Extract from an array REGBUF containing the (raw) register state
|
the address in which a function should return its structure value,
|
the address in which a function should return its structure value,
|
as a CORE_ADDR (or an expression that can be used as one). */
|
as a CORE_ADDR (or an expression that can be used as one). */
|
/* The address is passed in a0 upon entry to the function, but when
|
/* The address is passed in a0 upon entry to the function, but when
|
the function exits, the compiler has copied the value to v0. This
|
the function exits, the compiler has copied the value to v0. This
|
convention is specified by the System V ABI, so I think we can rely
|
convention is specified by the System V ABI, so I think we can rely
|
on it. */
|
on it. */
|
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
|
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
|
(extract_address (REGBUF + REGISTER_BYTE (RV_REGNUM), \
|
(extract_address (REGBUF + REGISTER_BYTE (RV_REGNUM), \
|
REGISTER_RAW_SIZE (RV_REGNUM)))
|
REGISTER_RAW_SIZE (RV_REGNUM)))
|
|
|
#ifdef GDBTK
|
#ifdef GDBTK
|
#define EXTRACT_STRUCT_VALUE_ADDRESS_P() 1
|
#define EXTRACT_STRUCT_VALUE_ADDRESS_P() 1
|
#else
|
#else
|
#define EXTRACT_STRUCT_VALUE_ADDRESS_P 1
|
#define EXTRACT_STRUCT_VALUE_ADDRESS_P 1
|
#endif
|
#endif
|
|
|
/* Advance PC across any function entry prologue instructions
|
/* Advance PC across any function entry prologue instructions
|
to reach some "real" code. */
|
to reach some "real" code. */
|
extern CORE_ADDR or1k_skip_prologue PARAMS ((CORE_ADDR addr, struct frame_info *fi));
|
extern CORE_ADDR or1k_skip_prologue PARAMS ((CORE_ADDR addr, struct frame_info *fi));
|
#define SKIP_PROLOGUE(pc) (or1k_skip_prologue (pc, NULL))
|
#define SKIP_PROLOGUE(pc) (or1k_skip_prologue (pc, NULL))
|
|
|
/* FRAMES */
|
/* FRAMES */
|
|
|
#define FRAME_ARGS_ADDRESS(fi) (fi)->frame
|
#define FRAME_ARGS_ADDRESS(fi) (fi)->frame
|
|
|
#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
|
#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
|
|
|
/* FRAME_CHAIN takes a frame's nominal address
|
/* FRAME_CHAIN takes a frame's nominal address
|
and produces the frame's chain-pointer. */
|
and produces the frame's chain-pointer. */
|
#define FRAME_CHAIN(thisframe) (CORE_ADDR) or1k_frame_chain (thisframe)
|
#define FRAME_CHAIN(thisframe) (CORE_ADDR) or1k_frame_chain (thisframe)
|
extern CORE_ADDR or1k_frame_chain PARAMS ((struct frame_info *));
|
extern CORE_ADDR or1k_frame_chain PARAMS ((struct frame_info *));
|
|
|
extern void or1k_init_extra_frame_info (int fromleaf, struct frame_info *);
|
extern void or1k_init_extra_frame_info (int fromleaf, struct frame_info *);
|
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) or1k_init_extra_frame_info (fromleaf, fi)
|
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) or1k_init_extra_frame_info (fromleaf, fi)
|
|
|
/* Discard from the stack the innermost frame, restoring all registers. */
|
/* Discard from the stack the innermost frame, restoring all registers. */
|
extern void or1k_pop_frame PARAMS ((void));
|
extern void or1k_pop_frame PARAMS ((void));
|
#define POP_FRAME or1k_pop_frame()
|
#define POP_FRAME or1k_pop_frame()
|
|
|
|
|
/* Return number of args passed to a frame.
|
/* Return number of args passed to a frame.
|
Can return -1, meaning no way to tell. */
|
Can return -1, meaning no way to tell. */
|
#define FRAME_NUM_ARGS(fi) (-1)
|
#define FRAME_NUM_ARGS(fi) (-1)
|
|
|
/* Return number of bytes at start of arglist that are not really args. */
|
/* Return number of bytes at start of arglist that are not really args. */
|
#define FRAME_ARGS_SKIP 0
|
#define FRAME_ARGS_SKIP 0
|
|
|
/* Put here the code to store, into a struct frame_saved_regs,
|
/* Put here the code to store, into a struct frame_saved_regs,
|
the addresses of the saved registers of frame described by FRAME_INFO.
|
the addresses of the saved registers of frame described by FRAME_INFO.
|
This includes special registers such as pc and fp saved in special
|
This includes special registers such as pc and fp saved in special
|
ways in the stack frame. sp is even more special:
|
ways in the stack frame. sp is even more special:
|
the address we return for it IS the sp for the next frame. */
|
the address we return for it IS the sp for the next frame. */
|
extern void or1k_init_saved_regs PARAMS ((struct frame_info *));
|
extern void or1k_init_saved_regs PARAMS ((struct frame_info *));
|
#define FRAME_INIT_SAVED_REGS(frame_info) or1k_init_saved_regs (frame_info);
|
#define FRAME_INIT_SAVED_REGS(frame_info) or1k_init_saved_regs (frame_info);
|
|
|
/* Saved Pc. */
|
/* Saved Pc. */
|
extern CORE_ADDR or1k_frame_saved_pc PARAMS ((struct frame_info *));
|
extern CORE_ADDR or1k_frame_saved_pc PARAMS ((struct frame_info *));
|
#define FRAME_SAVED_PC(FRAME) (or1k_frame_saved_pc(FRAME))
|
#define FRAME_SAVED_PC(FRAME) (or1k_frame_saved_pc(FRAME))
|
|
|
/* Set the return address register to point to the entry
|
/* Set the return address register to point to the entry
|
point of the program, where a breakpoint lies in wait. */
|
point of the program, where a breakpoint lies in wait. */
|
extern CORE_ADDR or1k_push_return_address PARAMS ((CORE_ADDR pc, CORE_ADDR sp));
|
extern CORE_ADDR or1k_push_return_address PARAMS ((CORE_ADDR pc, CORE_ADDR sp));
|
#define PUSH_RETURN_ADDRESS(PC, SP) (or1k_push_return_address ((PC), (SP)))
|
#define PUSH_RETURN_ADDRESS(PC, SP) (or1k_push_return_address ((PC), (SP)))
|
|
|
/* Immediately after a function call, return the saved pc.
|
/* Immediately after a function call, return the saved pc.
|
Can't always go through the frames for this because on some machines
|
Can't always go through the frames for this because on some machines
|
the new frame is not set up until the new function executes
|
the new frame is not set up until the new function executes
|
some instructions. */
|
some instructions. */
|
#define SAVED_PC_AFTER_CALL(frame) read_register(LR_REGNUM)
|
#define SAVED_PC_AFTER_CALL(frame) read_register(LR_REGNUM)
|
|
|
/* Offset from address of function to start of its code.
|
/* Offset from address of function to start of its code.
|
Zero on most machines. */
|
Zero on most machines. */
|
#define FUNCTION_START_OFFSET (0)
|
#define FUNCTION_START_OFFSET (0)
|
|
|
/* Floating point is IEEE compliant */
|
/* Floating point is IEEE compliant */
|
#define IEEE_FLOAT 1
|
#define IEEE_FLOAT 1
|
|
|
/* Is floating/vector unit present. */
|
/* Is floating/vector unit present. */
|
#define OR1K_VF_PRESENT (or1k_implementation.vf_present)
|
#define OR1K_VF_PRESENT (or1k_implementation.vf_present)
|
|
|
/* #define INIT_FRAME_PC */ /* Not necessary */
|
/* #define INIT_FRAME_PC */ /* Not necessary */
|
|
|
/* Stack grows downward. */
|
/* Stack grows downward. */
|
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
|
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
|
|
|
/* Size of stack entry - in bytes. */
|
/* Size of stack entry - in bytes. */
|
#define OR1K_STACK_ALIGN (8)
|
#define OR1K_STACK_ALIGN (8)
|
|
|
/* Maximum struct size, that is still stored onto stack. */
|
/* Maximum struct size, that is still stored onto stack. */
|
#define OR1K_STRUCT_CONV_SIZE (8)
|
#define OR1K_STRUCT_CONV_SIZE (8)
|
#define STACK_ALIGN(addr) OR1K_STACK_ALIGN
|
#define STACK_ALIGN(addr) OR1K_STACK_ALIGN
|
|
|
#define USE_STRUCT_CONVENTION(gcc_p, type) (TYPE_LENGTH (type) > OR1K_STRUCT_CONV_SIZE)
|
#define USE_STRUCT_CONVENTION(gcc_p, type) (TYPE_LENGTH (type) > OR1K_STRUCT_CONV_SIZE)
|
|
|
/* Stack must be aligned on 32-bit boundaries when synthesizing
|
/* Stack must be aligned on 32-bit boundaries when synthesizing
|
function calls. PUSH_ARGUMENTS will handle it. */
|
function calls. PUSH_ARGUMENTS will handle it. */
|
extern CORE_ADDR or1k_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR));
|
extern CORE_ADDR or1k_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR));
|
#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
|
#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
|
(or1k_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
|
(or1k_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
|
|
|
/* Return nonzero if instruction has delay slot */
|
/* Return nonzero if instruction has delay slot */
|
extern int is_delayed PARAMS ((unsigned long));
|
extern int is_delayed PARAMS ((unsigned long));
|
|
|
/* Return non-zero if PC points to an instruction which will cause a step
|
/* Return non-zero if PC points to an instruction which will cause a step
|
to execute both the instruction at PC and an instruction at PC+4. */
|
to execute both the instruction at PC and an instruction at PC+4. */
|
extern int or1k_step_skips_delay PARAMS ((CORE_ADDR));
|
extern int or1k_step_skips_delay PARAMS ((CORE_ADDR));
|
#define STEP_SKIPS_DELAY_P (1)
|
#define STEP_SKIPS_DELAY_P (1)
|
#define STEP_SKIPS_DELAY(pc) (or1k_step_skips_delay (pc))
|
#define STEP_SKIPS_DELAY(pc) (or1k_step_skips_delay (pc))
|
|
|
/* DUMMY CALLS */
|
/* DUMMY CALLS */
|
#define USE_GENERIC_DUMMY_FRAMES 1
|
#define USE_GENERIC_DUMMY_FRAMES 1
|
#define CALL_DUMMY {0}
|
#define CALL_DUMMY {0}
|
#define CALL_DUMMY_START_OFFSET (0)
|
#define CALL_DUMMY_START_OFFSET (0)
|
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
|
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
|
#define SIZEOF_CALL_DUMMY_WORDS (0)
|
#define SIZEOF_CALL_DUMMY_WORDS (0)
|
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
|
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
|
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
|
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
|
|
|
/* Return a location where we can set a breakpoint that will be hit
|
/* Return a location where we can set a breakpoint that will be hit
|
when an inferior function call returns. This is normally the
|
when an inferior function call returns. This is normally the
|
program's entry point. */
|
program's entry point. */
|
#define CALL_DUMMY_ADDRESS() entry_point_address ()
|
#define CALL_DUMMY_ADDRESS() entry_point_address ()
|
#define SAVE_DUMMY_FRAME_TOS(SP) generic_save_dummy_frame_tos (SP)
|
#define SAVE_DUMMY_FRAME_TOS(SP) generic_save_dummy_frame_tos (SP)
|
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
|
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
|
#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
|
#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
|
|
|
/* Definitions and declarations used by or1k dependent files. */
|
/* Definitions and declarations used by or1k dependent files. */
|
#define OR1K_INSTLEN 4 /* Length of an instruction */
|
#define OR1K_INSTLEN 4 /* Length of an instruction */
|
typedef unsigned long t_inst; /* Integer big enough to hold an instruction */
|
typedef unsigned long t_inst; /* Integer big enough to hold an instruction */
|
|
|
|
|
|
|
/* Defined in remote-or1k.c */
|
/* Defined in remote-or1k.c */
|
|
|
/* Target state names. */
|
/* Target state names. */
|
extern const char *status_name[];
|
extern const char *status_name[];
|
|
|
/* Target state. */
|
/* Target state. */
|
enum target_status
|
enum target_status
|
{
|
{
|
TARGET_UNDEFINED,
|
TARGET_UNDEFINED,
|
TARGET_CONNECTING,
|
TARGET_CONNECTING,
|
TARGET_DISCONNECTING,
|
TARGET_DISCONNECTING,
|
TARGET_RUNNING,
|
TARGET_RUNNING,
|
TARGET_STOPPED
|
TARGET_STOPPED
|
};
|
};
|
|
|
/* Compare conditions for DCRx registers. */
|
/* Compare conditions for DCRx registers. */
|
enum enum_compare_condition
|
enum enum_compare_condition
|
{
|
{
|
CC_MASKED, CC_EQUAL, CC_LESS, CC_LESSE, CC_GREAT, CC_GREATE, CC_NEQUAL
|
CC_MASKED, CC_EQUAL, CC_LESS, CC_LESSE, CC_GREAT, CC_GREATE, CC_NEQUAL
|
};
|
};
|
|
|
/* Compare operand to compare DVRx to. */
|
/* Compare operand to compare DVRx to. */
|
enum enum_compare_to
|
enum enum_compare_to
|
{
|
{
|
CT_DISABLED, CT_FETCH, CT_LEA, CT_SEA, CT_LDATA, CT_SDATA, CT_AEA, CT_ADATA
|
CT_DISABLED, CT_FETCH, CT_LEA, CT_SEA, CT_LDATA, CT_SDATA, CT_AEA, CT_ADATA
|
};
|
};
|
|
|
/* Matchpoint chaining types. */
|
/* Matchpoint chaining types. */
|
enum enum_chaining
|
enum enum_chaining
|
{
|
{
|
CHAINING_NONE, CHAINING_AND, CHAINING_OR
|
CHAINING_NONE, CHAINING_AND, CHAINING_OR
|
};
|
};
|
|
|
/* Names for cts. */
|
/* Names for cts. */
|
#define NUM_CT_NAMES 8
|
#define NUM_CT_NAMES 8
|
extern const char *compare_to_names[NUM_CT_NAMES];
|
extern const char *compare_to_names[NUM_CT_NAMES];
|
|
|
/* DRCx struct */
|
/* DRCx struct */
|
struct dcr_struct
|
struct dcr_struct
|
{
|
{
|
enum enum_compare_to ct:3;
|
enum enum_compare_to ct:3;
|
unsigned int sc:1;
|
unsigned int sc:1;
|
enum enum_compare_condition cc:3;
|
enum enum_compare_condition cc:3;
|
unsigned int dp:1;
|
unsigned int dp:1;
|
};
|
};
|
|
|
/* All data needed for a matchpoint. */
|
/* All data needed for a matchpoint. */
|
struct matchpoint
|
struct matchpoint
|
{
|
{
|
struct dcr_struct dcr;
|
struct dcr_struct dcr;
|
unsigned int dvr;
|
unsigned int dvr;
|
unsigned int chain_type;
|
unsigned int chain_type;
|
unsigned int cause_breakpoint;
|
unsigned int cause_breakpoint;
|
};
|
};
|
|
|
/* Trace related structures and data. */
|
/* Trace related structures and data. */
|
#define TRACE_FILENAME_SIZE (128)
|
#define TRACE_FILENAME_SIZE (128)
|
extern char trace_filename[TRACE_FILENAME_SIZE];
|
extern char trace_filename[TRACE_FILENAME_SIZE];
|
#define TRACE_FILENAME (&trace_filename[0])
|
#define TRACE_FILENAME (&trace_filename[0])
|
#define TRACE_DATA_SIZE (sizeof(struct htrace_data_struct))
|
#define TRACE_DATA_SIZE (sizeof(struct htrace_data_struct))
|
|
|
struct htrace_data_struct
|
struct htrace_data_struct
|
{
|
{
|
unsigned int unused:24;
|
unsigned int unused:24;
|
unsigned int data:32;
|
unsigned int data:32;
|
unsigned int type:4;
|
unsigned int type:4;
|
unsigned int reserved:3;
|
unsigned int reserved:3;
|
unsigned int valid:1;
|
unsigned int valid:1;
|
};
|
};
|
|
|
enum enum_operation
|
enum enum_operation
|
{
|
{
|
TRIGOP_ANY, TRIGOP_OR, TRIGOP_AND
|
TRIGOP_ANY, TRIGOP_OR, TRIGOP_AND
|
};
|
};
|
|
|
struct htrace_event_struct
|
struct htrace_event_struct
|
{
|
{
|
enum enum_operation operation:2;
|
enum enum_operation operation:2;
|
unsigned int reserved1:6;
|
unsigned int reserved1:6;
|
unsigned int is_valid:1;
|
unsigned int is_valid:1;
|
unsigned int is_trig:2;
|
unsigned int is_trig:2;
|
unsigned int ls_valid:1;
|
unsigned int ls_valid:1;
|
unsigned int ls_trig:4;
|
unsigned int ls_trig:4;
|
unsigned int reserved2:2;
|
unsigned int reserved2:2;
|
unsigned int bp_valid:1;
|
unsigned int bp_valid:1;
|
unsigned int bp_trig:1;
|
unsigned int bp_trig:1;
|
unsigned int wp_valid:1;
|
unsigned int wp_valid:1;
|
unsigned int wp_trig:11;
|
unsigned int wp_trig:11;
|
};
|
};
|
|
|
struct htrace_record_struct
|
struct htrace_record_struct
|
{
|
{
|
unsigned int reserved:25;
|
unsigned int reserved:25;
|
unsigned int rec:7;
|
unsigned int rec:7;
|
};
|
};
|
|
|
struct htrace_moder_struct
|
struct htrace_moder_struct
|
{
|
{
|
unsigned int reserved:29;
|
unsigned int reserved:29;
|
unsigned int rec_sel_dep:1;
|
unsigned int rec_sel_dep:1;
|
unsigned int trace_enable:1;
|
unsigned int trace_enable:1;
|
unsigned int contin:1;
|
unsigned int contin:1;
|
};
|
};
|
|
|
/* Number of records as defined in TAP. */
|
/* Number of records as defined in TAP. */
|
#define NUM_RECORDS (8)
|
#define NUM_RECORDS (8)
|
|
|
struct htrace_struct
|
struct htrace_struct
|
{
|
{
|
/* Local copy of HW regs for trace. */
|
/* Local copy of HW regs for trace. */
|
struct htrace_event_struct trig, qual, stop;
|
struct htrace_event_struct trig, qual, stop;
|
struct htrace_record_struct recwp[MAX_MATCHPOINTS], recbp;
|
struct htrace_record_struct recwp[MAX_MATCHPOINTS], recbp;
|
struct htrace_moder_struct moder;
|
struct htrace_moder_struct moder;
|
/* Which matchpoints does record use? Bitmask. */
|
/* Which matchpoints does record use? Bitmask. */
|
unsigned int wp_record_uses[MAX_MATCHPOINTS];
|
unsigned int wp_record_uses[MAX_MATCHPOINTS];
|
};
|
};
|
|
|
extern struct htrace_struct or1k_htrace;
|
extern struct htrace_struct or1k_htrace;
|
extern int trace_size;
|
extern int trace_size;
|
|
|
#define MAX_RECORD_NAMES 7
|
#define MAX_RECORD_NAMES 7
|
extern const char *or1k_record_names[MAX_RECORD_NAMES];
|
extern const char *or1k_record_names[MAX_RECORD_NAMES];
|
#define MAX_IS_NAMES 4
|
#define MAX_IS_NAMES 4
|
extern const char *or1k_is_names[MAX_IS_NAMES];
|
extern const char *or1k_is_names[MAX_IS_NAMES];
|
#define MAX_LS_NAMES 16
|
#define MAX_LS_NAMES 16
|
extern const char *or1k_ls_names[MAX_LS_NAMES];
|
extern const char *or1k_ls_names[MAX_LS_NAMES];
|
|
|
/* Stuff for HW watches. */
|
/* Stuff for HW watches. */
|
#define MAX_HW_WATCHES MAX_MATCHPOINTS
|
#define MAX_HW_WATCHES MAX_MATCHPOINTS
|
|
|
struct hwatch_struct
|
struct hwatch_struct
|
{
|
{
|
int matchpoint_start;
|
int matchpoint_start;
|
};
|
};
|
|
|
extern int num_hw_watches;
|
extern int num_hw_watches;
|
extern struct hwatch_struct or1k_hwatch[MAX_HW_WATCHES];
|
extern struct hwatch_struct or1k_hwatch[MAX_HW_WATCHES];
|
|
|
/* Possible errors are listed here. */
|
/* Possible errors are listed here. */
|
enum enum_errors /* modified <chris@asics.ws> CZ 24/05/01 */
|
enum enum_errors /* modified <chris@asics.ws> CZ 24/05/01 */
|
{
|
{
|
/* Codes > 0 are for system errors */
|
/* Codes > 0 are for system errors */
|
|
|
ERR_NONE = 0,
|
ERR_NONE = 0,
|
ERR_CRC = -1,
|
ERR_CRC = -1,
|
ERR_MEM = -2,
|
ERR_MEM = -2,
|
JTAG_PROXY_INVALID_COMMAND = -3,
|
JTAG_PROXY_INVALID_COMMAND = -3,
|
JTAG_PROXY_SERVER_TERMINATED = -4,
|
JTAG_PROXY_SERVER_TERMINATED = -4,
|
JTAG_PROXY_NO_CONNECTION = -5,
|
JTAG_PROXY_NO_CONNECTION = -5,
|
JTAG_PROXY_PROTOCOL_ERROR = -6,
|
JTAG_PROXY_PROTOCOL_ERROR = -6,
|
JTAG_PROXY_COMMAND_NOT_IMPLEMENTED = -7,
|
JTAG_PROXY_COMMAND_NOT_IMPLEMENTED = -7,
|
JTAG_PROXY_INVALID_CHAIN = -8,
|
JTAG_PROXY_INVALID_CHAIN = -8,
|
JTAG_PROXY_INVALID_ADDRESS = -9,
|
JTAG_PROXY_INVALID_ADDRESS = -9,
|
JTAG_PROXY_ACCESS_EXCEPTION = -10, /* Write to ROM */
|
JTAG_PROXY_ACCESS_EXCEPTION = -10, /* Write to ROM */
|
JTAG_PROXY_INVALID_LENGTH = -11,
|
JTAG_PROXY_INVALID_LENGTH = -11,
|
JTAG_PROXY_OUT_OF_MEMORY = -12,
|
JTAG_PROXY_OUT_OF_MEMORY = -12,
|
};
|
};
|
|
|
/* All JTAG chains. */
|
/* All JTAG chains. */
|
enum jtag_chains
|
enum jtag_chains
|
{
|
{
|
SC_GLOBAL, /* 0 Global BS Chain */
|
SC_GLOBAL, /* 0 Global BS Chain */
|
SC_RISC_DEBUG, /* 1 RISC Debug Interface chain */
|
SC_RISC_DEBUG, /* 1 RISC Debug Interface chain */
|
SC_RISC_TEST, /* 2 RISC Test Chain */
|
SC_RISC_TEST, /* 2 RISC Test Chain */
|
SC_TRACE, /* 3 Trace Chain */
|
SC_TRACE, /* 3 Trace Chain */
|
SC_REGISTER, /* 4 Register Chain */
|
SC_REGISTER, /* 4 Register Chain */
|
SC_WISHBONE, /* 5 Wisbone Chain */
|
SC_WISHBONE, /* 5 Wisbone Chain */
|
SC_BLOCK /* Block Chains */
|
SC_BLOCK /* Block Chains */
|
};
|
};
|
|
|
/* See JTAG documentation about these. */
|
/* See JTAG documentation about these. */
|
#define JI_SIZE (4)
|
#define JI_SIZE (4)
|
enum jtag_instr
|
enum jtag_instr
|
{
|
{
|
JI_EXTEST,
|
JI_EXTEST,
|
JI_SAMPLE_PRELOAD,
|
JI_SAMPLE_PRELOAD,
|
JI_IDCODE,
|
JI_IDCODE,
|
JI_CHAIN_SELECT,
|
JI_CHAIN_SELECT,
|
JI_INTEST,
|
JI_INTEST,
|
JI_CLAMP,
|
JI_CLAMP,
|
JI_CLAMPZ,
|
JI_CLAMPZ,
|
JI_HIGHZ,
|
JI_HIGHZ,
|
JI_DEBUG,
|
JI_DEBUG,
|
JI_BYPASS = 0xF
|
JI_BYPASS = 0xF
|
};
|
};
|
|
|
/* JTAG registers. */
|
/* JTAG registers. */
|
#define JTAG_MODER (0x0)
|
#define JTAG_MODER (0x0)
|
#define JTAG_TSEL (0x1)
|
#define JTAG_TSEL (0x1)
|
#define JTAG_QSEL (0x2)
|
#define JTAG_QSEL (0x2)
|
#define JTAG_SSEL (0x3)
|
#define JTAG_SSEL (0x3)
|
#define JTAG_RISCOP (0x4)
|
#define JTAG_RISCOP (0x4)
|
#define JTAG_RECWP0 (0x10)
|
#define JTAG_RECWP0 (0x10)
|
#define JTAG_RECBP0 (0x1b)
|
#define JTAG_RECBP0 (0x1b)
|
|
|
|
|
/* Current register values. */
|
/* Current register values. */
|
extern unsigned int dmr1;
|
extern unsigned int dmr1;
|
extern unsigned int dmr2;
|
extern unsigned int dmr2;
|
extern unsigned int dsr;
|
extern unsigned int dsr;
|
extern unsigned int drr;
|
extern unsigned int drr;
|
|
|
extern int matchpoint_user_count[MAX_MATCHPOINTS];
|
extern int matchpoint_user_count[MAX_MATCHPOINTS];
|
|
|
/* Current watchpoints. */
|
/* Current watchpoints. */
|
extern unsigned int dvr[MAX_MATCHPOINTS];
|
extern unsigned int dvr[MAX_MATCHPOINTS];
|
extern struct dcr_struct dcr[MAX_MATCHPOINTS];
|
extern struct dcr_struct dcr[MAX_MATCHPOINTS];
|
extern int debug_regs_changed;
|
extern int debug_regs_changed;
|
|
|
/* Returns error name. */
|
/* Returns error name. */
|
extern const char *or1k_err_name PARAMS ((int e));
|
extern const char *or1k_err_name PARAMS ((int e));
|
|
|
/* Last error number. */
|
/* Last error number. */
|
extern int err;
|
extern int err;
|
|
|
extern struct struct_or1k_implementation or1k_implementation;
|
extern struct struct_or1k_implementation or1k_implementation;
|
extern unsigned int or1k_fetch_instruction PARAMS ((CORE_ADDR addr));
|
extern unsigned int or1k_fetch_instruction PARAMS ((CORE_ADDR addr));
|
extern void or1k_fetch_registers PARAMS ((int regno));
|
extern void or1k_fetch_registers PARAMS ((int regno));
|
|
|
/* Sets register/memory regno to data. */
|
/* Sets register/memory regno to data. */
|
extern void or1k_write_spr_reg PARAMS ((unsigned int regno, unsigned int data));
|
extern void or1k_write_spr_reg PARAMS ((unsigned int regno, unsigned int data));
|
|
|
/* Sets register/memory regno to data. */
|
/* Sets register/memory regno to data. */
|
extern unsigned int or1k_read_spr_reg PARAMS ((unsigned int regno));
|
extern unsigned int or1k_read_spr_reg PARAMS ((unsigned int regno));
|
|
|
/* Flushes or1k's pipeline. */
|
/* Flushes or1k's pipeline. */
|
extern void or1k_flush_pipeline PARAMS ((void));
|
extern void or1k_flush_pipeline PARAMS ((void));
|
|
|
/* Sifts unused matchpoints to higher indexses. */
|
/* Sifts unused matchpoints to higher indexses. */
|
extern void sift_matchpoints ();
|
extern void sift_matchpoints ();
|
|
|
|
|
/* Added by Chris Ziomkowski <chris@asics.ws> 24/05/01 */
|
/* Added by Chris Ziomkowski <chris@asics.ws> 24/05/01 */
|
typedef enum {
|
typedef enum {
|
JTAG_COMMAND_READ = 1,
|
JTAG_COMMAND_READ = 1,
|
JTAG_COMMAND_WRITE = 2,
|
JTAG_COMMAND_WRITE = 2,
|
JTAG_COMMAND_BLOCK_READ = 3,
|
JTAG_COMMAND_BLOCK_READ = 3,
|
JTAG_COMMAND_BLOCK_WRITE = 4,
|
JTAG_COMMAND_BLOCK_WRITE = 4,
|
JTAG_COMMAND_CHAIN = 5,
|
JTAG_COMMAND_CHAIN = 5,
|
} JTAG_proxy_protocol_commands;
|
} JTAG_proxy_protocol_commands;
|
|
|
/* Each transmit structure must begin with an integer
|
/* Each transmit structure must begin with an integer
|
which specifies the type of command. Information
|
which specifies the type of command. Information
|
after this is variable. Make sure to have all information
|
after this is variable. Make sure to have all information
|
aligned properly. If we stick with 32 bit integers, it
|
aligned properly. If we stick with 32 bit integers, it
|
should be portable onto every platform. These structures
|
should be portable onto every platform. These structures
|
will be transmitted across the network in network byte
|
will be transmitted across the network in network byte
|
order.
|
order.
|
*/
|
*/
|
|
|
typedef struct {
|
typedef struct {
|
uint32_t command;
|
uint32_t command;
|
uint32_t length;
|
uint32_t length;
|
uint32_t address;
|
uint32_t address;
|
uint32_t data_H;
|
uint32_t data_H;
|
uint32_t data_L;
|
uint32_t data_L;
|
} JTAGProxyWriteMessage;
|
} JTAGProxyWriteMessage;
|
|
|
typedef struct {
|
typedef struct {
|
uint32_t command;
|
uint32_t command;
|
uint32_t length;
|
uint32_t length;
|
uint32_t address;
|
uint32_t address;
|
} JTAGProxyReadMessage;
|
} JTAGProxyReadMessage;
|
|
|
typedef struct {
|
typedef struct {
|
uint32_t command;
|
uint32_t command;
|
uint32_t length;
|
uint32_t length;
|
uint32_t address;
|
uint32_t address;
|
int32_t nRegisters;
|
int32_t nRegisters;
|
uint32_t data[1];
|
uint32_t data[1];
|
} JTAGProxyBlockWriteMessage;
|
} JTAGProxyBlockWriteMessage;
|
|
|
typedef struct {
|
typedef struct {
|
uint32_t command;
|
uint32_t command;
|
uint32_t length;
|
uint32_t length;
|
uint32_t address;
|
uint32_t address;
|
int32_t nRegisters;
|
int32_t nRegisters;
|
} JTAGProxyBlockReadMessage;
|
} JTAGProxyBlockReadMessage;
|
|
|
typedef struct {
|
typedef struct {
|
uint32_t command;
|
uint32_t command;
|
uint32_t length;
|
uint32_t length;
|
uint32_t chain;
|
uint32_t chain;
|
} JTAGProxyChainMessage;
|
} JTAGProxyChainMessage;
|
|
|
/* The responses are messages specific, however convention
|
/* The responses are messages specific, however convention
|
states the first word should be an error code. Again,
|
states the first word should be an error code. Again,
|
sticking with 32 bit integers should provide maximum
|
sticking with 32 bit integers should provide maximum
|
portability. */
|
portability. */
|
|
|
typedef struct {
|
typedef struct {
|
int32_t status;
|
int32_t status;
|
} JTAGProxyWriteResponse;
|
} JTAGProxyWriteResponse;
|
|
|
typedef struct {
|
typedef struct {
|
int32_t status;
|
int32_t status;
|
uint32_t data_H;
|
uint32_t data_H;
|
uint32_t data_L;
|
uint32_t data_L;
|
} JTAGProxyReadResponse;
|
} JTAGProxyReadResponse;
|
|
|
typedef struct {
|
typedef struct {
|
int32_t status;
|
int32_t status;
|
} JTAGProxyBlockWriteResponse;
|
} JTAGProxyBlockWriteResponse;
|
|
|
typedef struct {
|
typedef struct {
|
int32_t status;
|
int32_t status;
|
int32_t nRegisters;
|
int32_t nRegisters;
|
uint32_t data[1];
|
uint32_t data[1];
|
/* uint32_t data[nRegisters-1] still unread */
|
/* uint32_t data[nRegisters-1] still unread */
|
} JTAGProxyBlockReadResponse;
|
} JTAGProxyBlockReadResponse;
|
|
|
typedef struct {
|
typedef struct {
|
int32_t status;
|
int32_t status;
|
} JTAGProxyChainResponse;
|
} JTAGProxyChainResponse;
|
|
|
|
|
#endif /* TM_OR1K_H */
|
#endif /* TM_OR1K_H */
|
|
|