59 #define H8300_MAX_NUM_REGS 18 61 #define E_PSEUDO_CCR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch)) 62 #define E_PSEUDO_EXR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch)+1) 91 #define BINWORD(gdbarch) ((is_h8300hmode (gdbarch) \ 92 && !is_h8300_normal_mode (gdbarch)) \ 93 ? h8300h_reg_size : h8300_reg_size) 138 #define IS_MOVB_RnRm(x) (((x) & 0xff88) == 0x0c88) 139 #define IS_MOVW_RnRm(x) (((x) & 0xff88) == 0x0d00) 140 #define IS_MOVL_RnRm(x) (((x) & 0xff88) == 0x0f80) 141 #define IS_MOVB_Rn16_SP(x) (((x) & 0xfff0) == 0x6ee0) 142 #define IS_MOVB_EXT(x) ((x) == 0x7860) 143 #define IS_MOVB_Rn24_SP(x) (((x) & 0xfff0) == 0x6aa0) 144 #define IS_MOVW_Rn16_SP(x) (((x) & 0xfff0) == 0x6fe0) 145 #define IS_MOVW_EXT(x) ((x) == 0x78e0) 146 #define IS_MOVW_Rn24_SP(x) (((x) & 0xfff0) == 0x6ba0) 148 #define IS_MOVL_PRE(x) ((x) == 0x0100) 149 #define IS_MOVL_Rn16_SP(x) (((x) & 0xfff0) == 0x6fe0) 150 #define IS_MOVL_EXT(x) ((x) == 0x78e0) 151 #define IS_MOVL_Rn24_SP(x) (((x) & 0xfff0) == 0x6ba0) 153 #define IS_PUSHFP_MOVESPFP(x) ((x) == 0x6df60d76) 154 #define IS_PUSH_FP(x) ((x) == 0x01006df6) 155 #define IS_MOV_SP_FP(x) ((x) == 0x0ff6) 156 #define IS_SUB2_SP(x) ((x) == 0x1b87) 157 #define IS_SUB4_SP(x) ((x) == 0x1b97) 158 #define IS_ADD_IMM_SP(x) ((x) == 0x7a1f) 159 #define IS_SUB_IMM_SP(x) ((x) == 0x7a3f) 160 #define IS_SUBL4_SP(x) ((x) == 0x1acf) 161 #define IS_MOV_IMM_Rn(x) (((x) & 0xfff0) == 0x7905) 162 #define IS_SUB_RnSP(x) (((x) & 0xff0f) == 0x1907) 163 #define IS_ADD_RnSP(x) (((x) & 0xff0f) == 0x0907) 164 #define IS_PUSH(x) (((x) & 0xfff0) == 0x6df0) 184 && (w & 0x70) <= 0x20
185 && (w & 0x7) >= 0x3 && (w & 0x7) <= 0x5)
189 && 8 <= (w & 0xf) && (w & 0xf) <= 10)
203 if (disp < 0 && disp > 0xffffff)
222 if (disp < 0 && disp > 0xffffff)
244 if (disp < 0 && disp > 0xffffff)
295 int regno, i, spill_size;
299 if (pc >= current_pc)
314 if (pc >= current_pc)
324 while (pc < current_pc)
362 else if (
IS_SUB_RnSP (op) && (op & 0x00f0) == regno)
377 else if (op == 0x0100)
390 else if ((op & 0xffcf) == 0x0100)
398 i = ((op & 0x0030) >> 4) + 1;
399 regno = op1 & 0x000f;
400 for (; i > 0; regno++, --i)
418 && pc + spill_size <= current_pc)
446 if (cache->
base == 0)
494 if (cache->
base == 0)
500 static struct value *
556 if (sal.end && sal.end < func_end)
640 int stack_alloc = 0, stack_offset = 0;
650 for (argument = 0; argument < nargs; argument++)
663 for (argument = 0; argument < nargs; argument++)
672 std::vector<gdb_byte> padded (padded_len);
674 memcpy ((len <
wordsize ? padded.data () + padded_len - len
686 write_memory (sp + stack_offset, padded.data (), padded_len);
687 stack_offset += padded_len;
713 write_memory (sp + stack_offset, padded.data (), padded_len);
714 stack_offset += padded_len;
769 error (
_(
"I don't know how this 8 byte value is returned."));
801 error (
_(
"I don't know how this 8 byte value is returned."));
858 (val >> 16) & 0xffff);
864 error (
_(
"I don't know how to return an 8 byte value."));
888 (val >> 32) & 0xffffffff);
954 static const char *register_names[] = {
955 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
956 "sp",
"",
"pc",
"cycles",
"tick",
"inst",
960 || regno >= (
sizeof (register_names) /
sizeof (*register_names)))
962 _(
"h8300_register_name: illegal register number %d"),
965 return register_names[regno];
971 static const char *register_names[] = {
972 "er0",
"er1",
"er2",
"er3",
"er4",
"er5",
"er6",
973 "sp",
"",
"pc",
"cycles",
"",
"tick",
"inst",
978 || regno >= (
sizeof (register_names) /
sizeof (*register_names)))
980 _(
"h8300s_register_name: illegal register number %d"),
983 return register_names[regno];
989 static const char *register_names[] = {
990 "er0",
"er1",
"er2",
"er3",
"er4",
"er5",
"er6",
991 "sp",
"",
"pc",
"cycles",
"",
"tick",
"inst",
992 "mach",
"macl",
"sbr",
"vbr",
996 || regno >= (
sizeof (register_names) /
sizeof (*register_names)))
998 _(
"h8300sx_register_name: illegal register number %d"),
1001 return register_names[regno];
1033 unsigned char l = rval & 0xff;
1063 if ((Z | (N ^ V)) == 0)
1065 if ((Z | (N ^ V)) == 1)
1071 unsigned char l = rval & 0xff;
1083 struct frame_info *frame,
int regno,
int cpregs)
1128 static struct type *
1134 _(
"h8300_register_type: illegal register number %d"),
1164 gdb_byte *buf,
int pseudo_regno,
int raw_regno)
1182 const gdb_byte *buf,
int raw_regno,
int pseudo_regno)
1265 case bfd_mach_h8300:
1276 case bfd_mach_h8300h:
1277 case bfd_mach_h8300hn:
1296 case bfd_mach_h8300s:
1297 case bfd_mach_h8300sn:
1316 case bfd_mach_h8300sx:
1317 case bfd_mach_h8300sxn:
1368 h8300_breakpoint::kind_from_pc);
1370 h8300_breakpoint::bp_from_kind);
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
void set_gdbarch_double_bit(struct gdbarch *gdbarch, int double_bit)
static void h8300_pseudo_register_write(struct gdbarch *gdbarch, struct regcache *regcache, int regno, const gdb_byte *buf)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
#define E_PSEUDO_CCR_REGNUM(gdbarch)
struct type * builtin_func_ptr
CORE_ADDR get_frame_pc(struct frame_info *frame)
#define IS_MOVW_Rn24_SP(x)
static int h8300_dbg_reg_to_regnum(struct gdbarch *gdbarch, int regno)
void set_gdbarch_wchar_bit(struct gdbarch *gdbarch, int wchar_bit)
struct value * frame_unwind_got_memory(struct frame_info *frame, int regnum, CORE_ADDR addr)
void write_memory_unsigned_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, ULONGEST value)
static const char * h8300sx_register_name(struct gdbarch *gdbarch, int regno)
void set_gdbarch_stab_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
ULONGEST align_down(ULONGEST v, int n)
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
static void h8300h_store_return_value(struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
static void h8300h_extract_return_value(struct type *type, struct regcache *regcache, gdb_byte *valbuf)
constexpr gdb_byte h8300_break_insn[]
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
char * phex(ULONGEST l, int sizeof_l)
void internal_error(const char *file, int line, const char *fmt,...)
static void h8300_frame_this_id(struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
struct type * builtin_uint8
static void h8300_print_register(struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regno)
void _initialize_h8300_tdep(void)
static const char * h8300_register_name(struct gdbarch *gdbarch, int regno)
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
int gdbarch_num_regs(struct gdbarch *gdbarch)
const struct bfd_arch_info * bfd_arch_info
static int h8300_register_sim_regno(struct gdbarch *gdbarch, int regnum)
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
static int h8300s_dbg_reg_to_regnum(struct gdbarch *gdbarch, int regno)
static CORE_ADDR h8300_unwind_pc(struct gdbarch *gdbarch, struct frame_info *next_frame)
static enum register_status pseudo_from_raw_register(struct gdbarch *gdbarch, struct regcache *regcache, gdb_byte *buf, int pseudo_regno, int raw_regno)
static CORE_ADDR h8300_unwind_sp(struct gdbarch *gdbarch, struct frame_info *next_frame)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
void set_gdbarch_print_registers_info(struct gdbarch *gdbarch, gdbarch_print_registers_info_ftype print_registers_info)
struct type * builtin_int32
void set_gdbarch_wchar_signed(struct gdbarch *gdbarch, int wchar_signed)
#define FRAME_OBSTACK_ZALLOC(TYPE)
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
static void h8300_init_frame_cache(struct gdbarch *gdbarch, struct h8300_frame_cache *cache)
static const char * h8300s_register_name(struct gdbarch *gdbarch, int regno)
int gdbarch_num_pseudo_regs(struct gdbarch *gdbarch)
void set_gdbarch_addr_bit(struct gdbarch *gdbarch, int addr_bit)
static int is_h8300sxmode(struct gdbarch *gdbarch)
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
void set_gdbarch_ecoff_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)
void set_gdbarch_pseudo_register_write(struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype pseudo_register_write)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
LONGEST read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
const gdb_byte * value_contents(struct value *value)
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
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 enum return_value_convention h8300_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
void set_gdbarch_believe_pcc_promotion(struct gdbarch *gdbarch, int believe_pcc_promotion)
struct type * builtin_int16
static struct h8300_frame_cache * h8300_frame_cache(struct frame_info *this_frame, void **this_cache)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
static const struct frame_base h8300_frame_base
void set_gdbarch_register_sim_regno(struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype register_sim_regno)
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
LONGEST get_frame_register_signed(struct frame_info *frame, int regnum)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
static int is_h8300smode(struct gdbarch *gdbarch)
static enum return_value_convention h8300h_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static int h8300_use_struct_convention(struct type *value_type)
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
static CORE_ADDR h8300_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
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)
#define IS_MOVL_Rn24_SP(x)
static struct value * h8300_frame_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
#define IS_MOVL_Rn16_SP(x)
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
static struct type * h8300_register_type(struct gdbarch *gdbarch, int regno)
static CORE_ADDR h8300_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct h8300_frame_cache *cache)
static int h8300h_use_struct_convention(struct type *value_type)
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
CORE_ADDR saved_regs[H8300_MAX_NUM_REGS]
typedef BP_MANIPULATION(h8300_break_insn)
#define IS_MOVB_Rn16_SP(x)
static int is_h8300hmode(struct gdbarch *gdbarch)
void set_gdbarch_pseudo_register_read(struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype pseudo_register_read)
ULONGEST align_up(ULONGEST v, int n)
void set_gdbarch_char_signed(struct gdbarch *gdbarch, int char_signed)
void print_longest(struct ui_file *stream, int format, int use_c_format, LONGEST val_long)
#define TYPE_CODE(thistype)
enum register_status regcache_raw_read(struct regcache *regcache, int regnum, gdb_byte *buf)
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)
static void h8300_store_return_value(struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
static int is_h8300_normal_mode(struct gdbarch *gdbarch)
struct type * builtin_data_ptr
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
static const struct frame_unwind h8300_frame_unwind
void regcache_raw_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
static enum register_status h8300_pseudo_register_read(struct gdbarch *gdbarch, struct regcache *regcache, int regno, gdb_byte *buf)
static struct frame_id h8300_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
void set_gdbarch_double_format(struct gdbarch *gdbarch, const struct floatformat **double_format)
unsigned long long ULONGEST
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
#define IS_MOVB_Rn24_SP(x)
int register_size(struct gdbarch *gdbarch, int regnum)
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
struct type * value_type(const struct value *value)
void set_gdbarch_long_bit(struct gdbarch *gdbarch, int long_bit)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
const struct bfd_arch_info * gdbarch_bfd_arch_info(struct gdbarch *gdbarch)
static void h8300_print_registers_info(struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regno, int cpregs)
void set_gdbarch_long_double_format(struct gdbarch *gdbarch, const struct floatformat **long_double_format)
#define TYPE_LENGTH(thistype)
void set_gdbarch_ptr_bit(struct gdbarch *gdbarch, int ptr_bit)
#define E_PSEUDO_EXR_REGNUM(gdbarch)
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
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 int h8300_is_argument_spill(struct gdbarch *gdbarch, CORE_ADDR pc)
static void raw_from_pseudo_register(struct gdbarch *gdbarch, struct regcache *regcache, const gdb_byte *buf, int raw_regno, int pseudo_regno)
#define IS_PUSHFP_MOVESPFP(x)
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)
#define IS_MOVW_Rn16_SP(x)
enum bfd_endian byte_order
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
CORE_ADDR get_frame_func(struct frame_info *this_frame)
void error(const char *fmt,...)
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)
static CORE_ADDR h8300_frame_base_address(struct frame_info *this_frame, void **this_cache)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
#define H8300_MAX_NUM_REGS
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
static CORE_ADDR h8300_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)
void regcache_raw_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
static void h8300_extract_return_value(struct type *type, struct regcache *regcache, gdb_byte *valbuf)