52 #define TIC6X_OPCODE_SIZE 4 53 #define TIC6X_FETCH_PACKET_SIZE 32 55 #define INST_S_BIT(INST) ((INST >> 1) & 1) 56 #define INST_X_BIT(INST) ((INST >> 12) & 1) 85 "A0",
"A1",
"A2",
"A3",
86 "A4",
"A5",
"A6",
"A7",
87 "A8",
"A9",
"A10",
"A11",
88 "A12",
"A13",
"A14",
"A15",
89 "B0",
"B1",
"B2",
"B3",
90 "B4",
"B5",
"B6",
"B7",
91 "B8",
"B9",
"B10",
"B11",
92 "B12",
"B13",
"B14",
"B15",
98 static const int arg_regs[] = { 4, 20, 6, 22, 8, 24, 10, 26, 12, 28 };
151 unsigned int src_reg, base_reg, dst_reg;
155 int frame_base_offset_to_sp = 0;
157 int non_stw_insn_counter = 0;
159 if (start_pc >= current_pc)
160 return_pc = current_pc;
171 while (pc < current_pc)
175 if ((inst & 0x1ffc) == 0x1dc0 || (inst & 0x1ffc) == 0x1bc0
176 || (inst & 0x0ffc) == 0x9c0)
189 unsigned int ucst5 = (inst >> 13) & 0x1f;
191 if ((inst & 0x1ffc) == 0x1dc0)
192 frame_base_offset_to_sp += ucst5 << 2;
193 else if ((inst & 0x1ffc) == 0x1bc0)
194 frame_base_offset_to_sp += ucst5 << 1;
195 else if ((inst & 0x0ffc) == 0x9c0)
196 frame_base_offset_to_sp += ucst5;
203 else if ((inst & 0x174) == 0x74)
214 cache->
reg_saved[src_reg] = ((inst >> 13) & 0x1f) << 2;
218 non_stw_insn_counter = 0;
222 non_stw_insn_counter++;
236 if (non_stw_insn_counter >= 2)
253 if ((inst & 0x164) == 0x64
278 cache->
cfa = cache->
base + frame_base_offset_to_sp;
306 if (post_prologue_pc != 0)
307 return std::max (start_pc, post_prologue_pc);
393 void **this_prologue_cache)
399 if (*this_prologue_cache)
403 (*this_prologue_cache) = cache;
427 if (cache->
base == 0)
433 static struct value *
509 if (*this_cache == NULL)
519 void **this_prologue_cache)
557 static const int register_numbers[8] = { -1, 16, 17, 18, 1, 2, 0, -1 };
559 register_number = register_numbers[(inst >> 29) & 7];
560 if (register_number == -1)
564 if ((inst & 0x10000000) != 0)
565 return register_value == 0;
566 return register_value != 0;
575 int r = (
reg & 15) | ((crosspath ^ side) << 4);
584 int mask = (1 <<
bits) - 1;
585 int r = (
value >> low_bit) & mask;
586 if ((r & (1 << (
bits - 1))) != 0)
617 if ((inst & 0x0000007c) == 0x00000010)
624 if ((inst & 0x0f83effc) == 0x00000360)
634 if ((inst & 0x00001ffc) == 0x00001020)
646 if ((inst & 0x00001ffc) == 0x00000120)
653 if ((inst & 0x0f830ffe) == 0x00800362)
661 if ((inst & 0x00001ffc) == 0x00000020)
673 if ((inst & 0xf000007c) == 0x10000010)
689 static std::vector<CORE_ADDR>
710 enum bfd_endian byte_order,
gdb_byte *valbuf)
724 if (len < 3 && byte_order == BFD_ENDIAN_BIG)
737 if (byte_order == BFD_ENDIAN_BIG)
755 enum bfd_endian byte_order,
const gdb_byte *valbuf)
763 if (len < 3 && byte_order == BFD_ENDIAN_BIG)
771 if (byte_order == BFD_ENDIAN_BIG)
885 int stack_offset = 4;
886 int references_offset = 4;
892 int first_arg_on_stack = 10;
918 for (argnum = 0; argnum < nargs; argnum++)
921 if (argnum >= 10 - argreg)
922 references_offset += len;
934 for (argnum = 0; argnum < nargs; argnum++)
937 struct value *arg = args[argnum];
946 if (argreg < first_arg_on_stack)
960 if (len < 3 && byte_order == BFD_ENDIAN_BIG)
989 if (byte_order == BFD_ENDIAN_BIG)
1031 references_offset =
align_up (references_offset, 8);
1033 addr = sp + references_offset;
1035 references_offset +=
align_up (len, 4);
1069 stack_offset =
align_up (stack_offset,
1078 references_offset =
align_up (references_offset, 8);
1080 addr = sp + references_offset;
1084 references_offset +=
align_up (len, 4);
1094 _(
"unexpected type %d of arg %d"),
1099 _(
"unexpected length %d of arg %d"), len, argnum);
1101 addr = sp + stack_offset;
1120 if ((inst & 0x0f83effc) == 0x360)
1182 if (feature == NULL)
1188 for (i = 0; i < 32; i++)
1208 static const char *
const gp[] =
1210 "A16",
"A17",
"A18",
"A19",
"A20",
"A21",
"A22",
"A23",
1211 "A24",
"A25",
"A26",
"A27",
"A28",
"A29",
"A30",
"A31",
1212 "B16",
"B17",
"B18",
"B19",
"B20",
"B21",
"B22",
"B23",
1213 "B24",
"B25",
"B26",
"B27",
"B28",
"B29",
"B30",
"B31",
1218 for (j = 0; j < 32; j++)
1252 if (has_gp != tdep->
has_gp)
const gdb_byte tic6x_bkpt_illegal_opcode_be[]
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
static int tic6x_extract_signed_field(int value, int low_bit, int bits)
void set_gdbarch_double_bit(struct gdbarch *gdbarch, int double_bit)
void set_gdbarch_frame_align(struct gdbarch *gdbarch, gdbarch_frame_align_ftype frame_align)
void set_gdbarch_float_format(struct gdbarch *gdbarch, const struct floatformat **float_format)
CORE_ADDR(* syscall_next_pc)(struct frame_info *frame)
#define TIC6X_FETCH_PACKET_SIZE
ULONGEST regcache_raw_get_unsigned(struct regcache *regcache, int regnum)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
void set_gdbarch_get_longjmp_target(struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype get_longjmp_target)
CORE_ADDR get_frame_address_in_block(struct frame_info *this_frame)
static std::vector< CORE_ADDR > tic6x_software_single_step(struct regcache *regcache)
static unsigned long tic6x_fetch_instruction(struct gdbarch *, CORE_ADDR)
struct type * builtin_func_ptr
void set_gdbarch_float_bit(struct gdbarch *gdbarch, int float_bit)
CORE_ADDR get_frame_pc(struct frame_info *frame)
struct frame_info * get_current_frame(void)
void gdbarch_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
static CORE_ADDR tic6x_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR start_pc)
static const struct frame_unwind tic6x_frame_unwind
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
struct value * frame_unwind_got_memory(struct frame_info *frame, int regnum, CORE_ADDR addr)
static const struct frame_unwind tic6x_stub_unwind
ULONGEST align_down(ULONGEST v, int n)
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
void regcache_cooked_write_signed(struct regcache *regcache, int regnum, LONGEST val)
void set_gdbarch_short_bit(struct gdbarch *gdbarch, int short_bit)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
void internal_error(const char *file, int line, const char *fmt,...)
static void tic6x_setup_default(struct tic6x_unwind_cache *cache)
void frame_unwind_register(struct frame_info *frame, int regnum, gdb_byte *buf)
const char * tdesc_register_name(struct gdbarch *gdbarch, int regno)
static struct gdbarch * tic6x_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
static int tic6x_arg_type_alignment(struct type *type)
static void tic6x_dwarf2_frame_init_reg(struct gdbarch *gdbarch, int regnum, struct dwarf2_frame_state_reg *reg, struct frame_info *this_frame)
const gdb_byte * breakpoint
static const char * tic6x_register_name(struct gdbarch *gdbarch, int regno)
void regcache_cooked_write_part(struct regcache *regcache, int regnum, int offset, int len, const gdb_byte *buf)
enum language la_language
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
CORE_ADDR skip_prologue_using_sal(struct gdbarch *gdbarch, CORE_ADDR func_addr)
struct gdbarch_list * next
void set_gdbarch_return_in_first_hidden_param_p(struct gdbarch *gdbarch, gdbarch_return_in_first_hidden_param_p_ftype return_in_first_hidden_param_p)
static int tic6x_return_in_first_hidden_param_p(struct gdbarch *gdbarch, struct type *type)
#define bits(obj, st, fn)
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
void tdesc_data_cleanup(void *data_untyped)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
#define FRAME_OBSTACK_ZALLOC(TYPE)
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
static CORE_ADDR tic6x_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
static struct tic6x_unwind_cache * tic6x_make_stub_cache(struct frame_info *this_frame)
void set_gdbarch_addr_bit(struct gdbarch *gdbarch, int addr_bit)
int tdesc_numbered_register(const struct tdesc_feature *feature, struct tdesc_arch_data *data, int regno, const char *name)
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
static int tic6x_register_number(int reg, int side, int crosspath)
LONGEST regcache_raw_get_signed(struct regcache *regcache, int regnum)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
struct type * check_typedef(struct type *type)
const gdb_byte * value_contents(struct value *value)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
static CORE_ADDR tic6x_frame_base_address(struct frame_info *this_frame, void **this_cache)
void set_gdbarch_stack_frame_destroyed_p(struct gdbarch *gdbarch, gdbarch_stack_frame_destroyed_p_ftype stack_frame_destroyed_p)
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
static const char *const tic6x_register_names[]
static int tic6x_get_longjmp_target(struct frame_info *frame, CORE_ADDR *pc)
#define gdb_assert_not_reached(message)
static struct type * tic6x_register_type(struct gdbarch *gdbarch, int regno)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
struct type * builtin_uint32
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
#define TIC6X_OPCODE_SIZE
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
static struct frame_id tic6x_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
static int tic6x_condition_true(struct regcache *regcache, unsigned long inst)
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
static CORE_ADDR tic6x_analyze_prologue(struct gdbarch *gdbarch, const CORE_ADDR start_pc, const CORE_ADDR current_pc, struct tic6x_unwind_cache *cache, struct frame_info *this_frame)
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
const struct target_desc * target_desc
static int tic6x_stack_frame_destroyed_p(struct gdbarch *gdbarch, CORE_ADDR pc)
void set_gdbarch_software_single_step(struct gdbarch *gdbarch, gdbarch_software_single_step_ftype software_single_step)
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
static CORE_ADDR tic6x_unwind_sp(struct gdbarch *gdbarch, struct frame_info *this_frame)
void tdesc_use_registers(struct gdbarch *gdbarch, const struct target_desc *target_desc, struct tdesc_arch_data *early_data)
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
void _initialize_tic6x_tdep(void)
ULONGEST align_up(ULONGEST v, int n)
const struct language_defn * current_language
#define TYPE_TARGET_TYPE(thistype)
#define TYPE_CODE(thistype)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct value * frame_unwind_got_register(struct frame_info *frame, int regnum, int new_regnum)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
CORE_ADDR regcache_read_pc(struct regcache *regcache)
CORE_ADDR find_function_addr(struct value *function, struct type **retval_type)
static int in_plt_section(CORE_ADDR pc)
static int tic6x_stub_unwind_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
CORE_ADDR reg_saved[TIC6X_NUM_CORE_REGS]
static void tic6x_stub_this_id(struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
static const int arg_regs[]
static CORE_ADDR tic6x_get_next_pc(struct regcache *regcache, CORE_ADDR pc)
#define TYPE_NFIELDS(thistype)
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
enum register_status regcache_cooked_read(struct regcache *regcache, int regnum, gdb_byte *buf)
static CORE_ADDR tic6x_unwind_pc(struct gdbarch *gdbarch, struct frame_info *next_frame)
static const gdb_byte * tic6x_sw_breakpoint_from_kind(struct gdbarch *gdbarch, int kind, int *size)
void set_gdbarch_double_format(struct gdbarch *gdbarch, const struct floatformat **double_format)
static void tic6x_frame_this_id(struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
struct tdesc_arch_data * tdesc_data_alloc(void)
unsigned long long ULONGEST
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
const struct tdesc_feature * tdesc_find_feature(const struct target_desc *target_desc, const char *name)
static CORE_ADDR tic6x_frame_align(struct gdbarch *gdbarch, CORE_ADDR addr)
static const struct frame_base tic6x_frame_base
struct type * value_type(const struct value *value)
void set_gdbarch_long_bit(struct gdbarch *gdbarch, int long_bit)
enum register_status regcache_cooked_read_part(struct regcache *regcache, int regnum, int offset, int len, gdb_byte *buf)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
void dwarf2_frame_set_init_reg(struct gdbarch *gdbarch, void(*init_reg)(struct gdbarch *, int, struct dwarf2_frame_state_reg *, struct frame_info *))
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
#define TYPE_LENGTH(thistype)
void set_gdbarch_ptr_bit(struct gdbarch *gdbarch, int ptr_bit)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype push_dummy_call)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
static void tic6x_extract_return_value(struct type *valtype, struct regcache *regcache, enum bfd_endian byte_order, gdb_byte *valbuf)
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
void register_gdbarch_init(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype skip_prologue)
static struct value * tic6x_frame_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
static struct gdbarch_data * tdesc_data
enum bfd_endian byte_order
static struct tic6x_unwind_cache * tic6x_frame_unwind_cache(struct frame_info *this_frame, void **this_prologue_cache)
enum bfd_endian gdbarch_byte_order_for_code(struct gdbarch *gdbarch)
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
static void tic6x_store_return_value(struct type *valtype, struct regcache *regcache, enum bfd_endian byte_order, const gdb_byte *valbuf)
int tdesc_has_registers(const struct target_desc *target_desc)
static int tic6x_breakpoint_kind_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
CORE_ADDR get_frame_func(struct frame_info *this_frame)
static enum return_value_convention tic6x_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, struct gdbarch_tdep *tdep)
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype inner_than)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
const gdb_byte tic6x_bkpt_illegal_opcode_le[]
void regcache_cooked_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
int language_pass_by_reference(struct type *type)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
const struct target_desc * gdbarch_target_desc(struct gdbarch *gdbarch)