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)
119#define IS_MOVB_RnRm(x) (((x) & 0xff88) == 0x0c88)
120#define IS_MOVW_RnRm(x) (((x) & 0xff88) == 0x0d00)
121#define IS_MOVL_RnRm(x) (((x) & 0xff88) == 0x0f80)
122#define IS_MOVB_Rn16_SP(x) (((x) & 0xfff0) == 0x6ee0)
123#define IS_MOVB_EXT(x) ((x) == 0x7860)
124#define IS_MOVB_Rn24_SP(x) (((x) & 0xfff0) == 0x6aa0)
125#define IS_MOVW_Rn16_SP(x) (((x) & 0xfff0) == 0x6fe0)
126#define IS_MOVW_EXT(x) ((x) == 0x78e0)
127#define IS_MOVW_Rn24_SP(x) (((x) & 0xfff0) == 0x6ba0)
129#define IS_MOVL_PRE(x) ((x) == 0x0100)
130#define IS_MOVL_Rn16_SP(x) (((x) & 0xfff0) == 0x6fe0)
131#define IS_MOVL_EXT(x) ((x) == 0x78e0)
132#define IS_MOVL_Rn24_SP(x) (((x) & 0xfff0) == 0x6ba0)
134#define IS_PUSHFP_MOVESPFP(x) ((x) == 0x6df60d76)
135#define IS_PUSH_FP(x) ((x) == 0x01006df6)
136#define IS_MOV_SP_FP(x) ((x) == 0x0ff6)
137#define IS_SUB2_SP(x) ((x) == 0x1b87)
138#define IS_SUB4_SP(x) ((x) == 0x1b97)
139#define IS_ADD_IMM_SP(x) ((x) == 0x7a1f)
140#define IS_SUB_IMM_SP(x) ((x) == 0x7a3f)
141#define IS_SUBL4_SP(x) ((x) == 0x1acf)
142#define IS_MOV_IMM_Rn(x) (((x) & 0xfff0) == 0x7905)
143#define IS_SUB_RnSP(x) (((x) & 0xff0f) == 0x1907)
144#define IS_ADD_RnSP(x) (((x) & 0xff0f) == 0x0907)
145#define IS_PUSH(x) (((x) & 0xfff0) == 0x6df0)
165 && (w & 0x70) <= 0x20
166 && (w & 0x7) >= 0x3 && (w & 0x7) <= 0x5)
170 && 8 <= (w & 0xf) && (w & 0xf) <= 10)
184 if ((disp & 0x00800000) != 0)
203 if ((disp & 0x00800000) != 0)
226 if ((disp & 0x00800000) != 0)
272 CORE_ADDR pc, CORE_ADDR current_pc,
277 int regno, i, spill_size;
281 if (pc >= current_pc)
296 if (pc >= current_pc)
306 while (pc < current_pc)
344 else if (
IS_SUB_RnSP (op) && (op & 0x00f0) == regno)
359 else if (op == 0x0100)
372 else if ((op & 0xffcf) == 0x0100)
380 i = ((op & 0x0030) >> 4) + 1;
381 regno = op1 & 0x000f;
382 for (; i > 0; regno++, --i)
400 && pc + spill_size <= current_pc)
412 CORE_ADDR current_pc;
428 if (cache->
base == 0)
476 if (cache->
base == 0)
530 CORE_ADDR func_addr = 0 , func_end = 0;
539 if (sal.
end && sal.
end < func_end)
549 return (CORE_ADDR)
pc;
619 int nargs,
struct value **args, CORE_ADDR sp,
621 CORE_ADDR struct_addr)
624 int stack_alloc = 0, stack_offset = 0;
630 sp = align_down (sp, wordsize);
634 for (argument = 0; argument < nargs; argument++)
635 stack_alloc += align_up (args[argument]->
type ()->length (), wordsize);
646 for (argument = 0; argument < nargs; argument++)
648 struct type *
type = args[argument]->type ();
650 char *contents = (
char *) args[argument]->contents ().data ();
653 int padded_len = align_up (len, wordsize);
655 std::vector<gdb_byte> padded (padded_len);
657 memcpy ((len < wordsize ? padded.data () + padded_len - len
666 if (len > wordsize && len % wordsize)
669 write_memory (sp + stack_offset, padded.data (), padded_len);
670 stack_offset += padded_len;
675 reg += padded_len / wordsize;
684 for (offset = 0; offset < padded_len; offset += wordsize)
688 wordsize, byte_order);
696 write_memory (sp + stack_offset, padded.data (), padded_len);
697 stack_offset += padded_len;
714 return sp + wordsize;
752 error (_(
"I don't know how this 8 byte value is returned."));
784 error (_(
"I don't know how this 8 byte value is returned."));
796 if (value_type->
code () == TYPE_CODE_STRUCT
797 || value_type->
code () == TYPE_CODE_UNION)
799 return !(value_type->
length () == 1
800 || value_type->
length () == 2
801 || value_type->
length () == 4);
809 if (value_type->
code () == TYPE_CODE_STRUCT
810 || value_type->
code () == TYPE_CODE_UNION)
812 return !(value_type->
length () == 1
813 || value_type->
length () == 2
814 || value_type->
length () == 4
815 || (value_type->
length () == 8
816 && value_type->
code () == TYPE_CODE_INT));
825 const gdb_byte *valbuf)
841 (val >> 16) & 0xffff);
847 error (_(
"I don't know how to return an 8 byte value."));
854 const gdb_byte *valbuf)
871 (val >> 32) & 0xffffffff);
881 gdb_byte *readbuf,
const gdb_byte *writebuf)
895 gdb_byte *readbuf,
const gdb_byte *writebuf)
937 return regnames[regno];
945 static const char *register_names[] = {
946 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
947 "sp",
"",
"pc",
"cycles",
"tick",
"inst",
957 static const char *register_names[] = {
958 "er0",
"er1",
"er2",
"er3",
"er4",
"er5",
"er6",
959 "sp",
"",
"pc",
"cycles",
"tick",
"inst",
969 static const char *register_names[] = {
970 "er0",
"er1",
"er2",
"er3",
"er4",
"er5",
"er6",
971 "sp",
"",
"pc",
"cycles",
"",
"tick",
"inst",
982 static const char *register_names[] = {
983 "er0",
"er1",
"er2",
"er3",
"er4",
"er5",
"er6",
984 "sp",
"",
"pc",
"cycles",
"",
"tick",
"inst",
985 "mach",
"macl",
"sbr",
"vbr",
1008 gdb_printf (file,
"0x%02x ", (
unsigned char) rval);
1013 gdb_printf (file,
"0x%s ", phex ((ULONGEST) rval,
1021 unsigned char l = rval & 0xff;
1024 gdb_printf (file,
"UI-%d ", (l & 0x40) != 0);
1051 if ((Z | (N ^ V)) == 0)
1053 if ((Z | (N ^ V)) == 1)
1059 unsigned char l = rval & 0xff;
1061 gdb_printf (file,
"T-%d - - - ", (l & 0x80) != 0);
1120 internal_error (_(
"h8300_register_type: illegal register number %d"),
1148static enum register_status
1150 gdb_byte *buf,
int pseudo_regno,
int raw_regno)
1153 enum register_status
status;
1168 const gdb_byte *buf,
int raw_regno,
int pseudo_regno)
1178static enum register_status
1200 const gdb_byte *buf)
1242 if (
info.bfd_arch_info->arch != bfd_arch_h8300)
1249 switch (
info.bfd_arch_info->mach)
1251 case bfd_mach_h8300:
1261 case bfd_mach_h8300h:
1262 case bfd_mach_h8300hn:
1268 if (
info.bfd_arch_info->mach != bfd_mach_h8300hn)
1280 case bfd_mach_h8300s:
1281 case bfd_mach_h8300sn:
1287 if (
info.bfd_arch_info->mach != bfd_mach_h8300sn)
1299 case bfd_mach_h8300sx:
1300 case bfd_mach_h8300sxn:
1306 if (
info.bfd_arch_info->mach != bfd_mach_h8300sxn)
1347 h8300_breakpoint::kind_from_pc);
1349 h8300_breakpoint::bp_from_kind);
void gdbarch_register(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init, gdbarch_dump_tdep_ftype *dump_tdep, gdbarch_supports_arch_info_ftype *supports_arch_info)
static std::vector< const char * > arches
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
#define BP_MANIPULATION(BREAK_INSN)
bool find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr, const struct block **block)
enum register_status raw_read(int regnum, gdb_byte *buf)
void raw_write(int regnum, const gdb_byte *buf)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
void write_memory_unsigned_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, ULONGEST value)
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
LONGEST read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
@ RETURN_VALUE_ABI_RETURNS_ADDRESS
@ RETURN_VALUE_REGISTER_CONVENTION
@ RETURN_VALUE_STRUCT_CONVENTION
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
int default_frame_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **this_prologue_cache)
struct value * frame_unwind_got_memory(frame_info_ptr frame, int regnum, CORE_ADDR addr)
struct value * frame_unwind_got_register(frame_info_ptr frame, int regnum, int new_regnum)
enum unwind_stop_reason default_frame_unwind_stop_reason(frame_info_ptr this_frame, void **this_cache)
struct value * frame_unwind_got_constant(frame_info_ptr frame, int regnum, ULONGEST val)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
ULONGEST get_frame_register_unsigned(frame_info_ptr frame, int regnum)
LONGEST get_frame_register_signed(frame_info_ptr frame, int regnum)
CORE_ADDR get_frame_pc(frame_info_ptr frame)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
CORE_ADDR get_frame_func(frame_info_ptr this_frame)
#define FRAME_OBSTACK_ZALLOC(TYPE)
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
void set_gdbarch_stab_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum)
void set_gdbarch_addr_bit(struct gdbarch *gdbarch, int addr_bit)
void set_gdbarch_char_signed(struct gdbarch *gdbarch, int char_signed)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc)
void set_gdbarch_register_sim_regno(struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype *register_sim_regno)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue)
void set_gdbarch_wchar_bit(struct gdbarch *gdbarch, int wchar_bit)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name)
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value)
void set_gdbarch_believe_pcc_promotion(struct gdbarch *gdbarch, int believe_pcc_promotion)
void set_gdbarch_wchar_signed(struct gdbarch *gdbarch, int wchar_signed)
void set_gdbarch_print_registers_info(struct gdbarch *gdbarch, gdbarch_print_registers_info_ftype *print_registers_info)
int gdbarch_num_regs(struct gdbarch *gdbarch)
void set_gdbarch_double_bit(struct gdbarch *gdbarch, int double_bit)
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than)
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
void set_gdbarch_long_double_format(struct gdbarch *gdbarch, const struct floatformat **long_double_format)
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type)
void set_gdbarch_pseudo_register_write(struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype *pseudo_register_write)
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum)
void set_gdbarch_long_bit(struct gdbarch *gdbarch, int long_bit)
void set_gdbarch_ptr_bit(struct gdbarch *gdbarch, int ptr_bit)
void set_gdbarch_pseudo_register_read(struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype *pseudo_register_read)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
const struct bfd_arch_info * gdbarch_bfd_arch_info(struct gdbarch *gdbarch)
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind)
void set_gdbarch_double_format(struct gdbarch *gdbarch, const struct floatformat **double_format)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call)
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, gdbarch_tdep_up tdep)
static int gdbarch_num_cooked_regs(gdbarch *arch)
function_call_return_method
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
static struct type * h8300_register_type(struct gdbarch *gdbarch, int regno)
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, function_call_return_method return_method, CORE_ADDR struct_addr)
static const struct frame_unwind h8300_frame_unwind
#define E_PSEUDO_CCR_REGNUM(gdbarch)
static void h8300h_extract_return_value(struct type *type, struct regcache *regcache, gdb_byte *valbuf)
static int h8300_use_struct_convention(struct type *value_type)
#define IS_MOVL_Rn24_SP(x)
#define IS_MOVB_Rn16_SP(x)
static const char * h8300s_register_name(struct gdbarch *gdbarch, int regno)
static CORE_ADDR h8300_frame_base_address(frame_info_ptr this_frame, void **this_cache)
static int h8300_is_argument_spill(struct gdbarch *gdbarch, CORE_ADDR pc)
static int is_h8300hmode(struct gdbarch *gdbarch)
static CORE_ADDR h8300_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct h8300_frame_cache *cache)
static CORE_ADDR h8300_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
constexpr gdb_byte h8300_break_insn[]
static const struct frame_base h8300_frame_base
static int h8300h_use_struct_convention(struct type *value_type)
static enum register_status pseudo_from_raw_register(struct gdbarch *gdbarch, readable_regcache *regcache, gdb_byte *buf, int pseudo_regno, int raw_regno)
static int h8300s_dbg_reg_to_regnum(struct gdbarch *gdbarch, int regno)
static void raw_from_pseudo_register(struct gdbarch *gdbarch, struct regcache *regcache, const gdb_byte *buf, int raw_regno, int pseudo_regno)
static int h8300_register_sim_regno(struct gdbarch *gdbarch, int regnum)
void _initialize_h8300_tdep()
static const char * h8300_register_name(struct gdbarch *gdbarch, int regno)
static struct value * h8300_frame_prev_register(frame_info_ptr this_frame, void **this_cache, int regnum)
#define IS_PUSHFP_MOVESPFP(x)
static void h8300_init_frame_cache(struct gdbarch *gdbarch, struct h8300_frame_cache *cache)
static const char * h8300sx_register_name(struct gdbarch *gdbarch, int regno)
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)
#define IS_MOVL_Rn16_SP(x)
#define IS_MOVB_Rn24_SP(x)
#define H8300_MAX_NUM_REGS
static void h8300_print_registers_info(struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, int regno, int cpregs)
static void h8300_frame_this_id(frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
static enum register_status h8300_pseudo_register_read(struct gdbarch *gdbarch, readable_regcache *regcache, int regno, gdb_byte *buf)
static void h8300h_store_return_value(struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
static const char * h8300_register_name_common(const char *regnames[], int numregs, struct gdbarch *gdbarch, int regno)
static int h8300_dbg_reg_to_regnum(struct gdbarch *gdbarch, int regno)
static const char * h8300h_register_name(struct gdbarch *gdbarch, int regno)
#define IS_MOVW_Rn16_SP(x)
#define E_PSEUDO_EXR_REGNUM(gdbarch)
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)
static void h8300_print_register(struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, int regno)
static struct h8300_frame_cache * h8300_frame_cache(frame_info_ptr this_frame, void **this_cache)
static int is_h8300sxmode(struct gdbarch *gdbarch)
#define IS_MOVW_Rn24_SP(x)
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)
static void h8300_pseudo_register_write(struct gdbarch *gdbarch, struct regcache *regcache, int regno, const gdb_byte *buf)
static void h8300_extract_return_value(struct type *type, struct regcache *regcache, gdb_byte *valbuf)
static int is_h8300smode(struct gdbarch *gdbarch)
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
int register_size(struct gdbarch *gdbarch, int regnum)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void regcache_raw_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct type * builtin_func_ptr
struct type * builtin_data_ptr
struct type * builtin_int32
struct type * builtin_uint8
struct type * builtin_int16
CORE_ADDR saved_regs[H8300_MAX_NUM_REGS]
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
void gdb_printf(struct ui_file *stream, const char *format,...)
void print_longest(struct ui_file *stream, int format, int use_c_format, LONGEST val_long)