41 #define MN10300_MAX_NUM_REGS 64 44 #define MN10300_MAX_REGISTER_SIZE 64 113 while (align < falign)
186 else if (len <= 2 * regsz)
191 len - regsz, valbuf + regsz);
195 _(
"Cannot store return value %d bytes long."), len);
216 memcpy (valbuf, buf, len);
218 else if (len <= 2 * regsz)
221 memcpy (valbuf, buf, regsz);
224 memcpy ((
char *) valbuf + regsz, buf, len - regsz);
228 _(
"Cannot extract return value %d bytes long."), len);
265 static const char *regs[] =
266 {
"d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
267 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"",
"",
268 "",
"",
"",
"",
"",
"",
"",
"",
269 "",
"",
"",
"",
"",
"",
"",
"fp" 278 static const char *regs[] =
279 {
"d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
280 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"",
281 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
282 "ssp",
"msp",
"usp",
"mcrh",
"mcrl",
"mcvf",
"",
"",
"" 290 static const char *regs[] =
292 "d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
293 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"mdrq",
"r0",
294 "r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
"ssp",
295 "msp",
"usp",
"mcrh",
"mcrl",
"mcvf",
"fpcr",
"",
"",
296 "fs0",
"fs1",
"fs2",
"fs3",
"fs4",
"fs5",
"fs6",
"fs7",
297 "fs8",
"fs9",
"fs10",
"fs11",
"fs12",
"fs13",
"fs14",
"fs15",
298 "fs16",
"fs17",
"fs18",
"fs19",
"fs20",
"fs21",
"fs22",
"fs23",
299 "fs24",
"fs25",
"fs26",
"fs27",
"fs28",
"fs29",
"fs30",
"fs31" 351 if (rreg > 7 && rreg < 12)
353 else if (rreg > 11 && rreg < 16)
389 CORE_ADDR after_last_frame_setup_insn = start_pc;
392 memset (result, 0,
sizeof (*result));
411 while (pc < limit_pc)
424 if (instr[0] == 0xcf)
428 save_mask = instr[1];
475 after_last_frame_setup_insn = pc;
478 else if ((instr[0] & 0xfc) == 0x3c)
480 int aN = instr[0] & 0x03;
486 after_last_frame_setup_insn = pc;
489 else if ((instr[0] & 0xf0) == 0x90
490 && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
492 int aN = instr[0] & 0x03;
493 int aM = (instr[0] & 0x0c) >> 2;
500 else if ((instr[0] & 0xf0) == 0x80
501 && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
503 int dN = instr[0] & 0x03;
504 int dM = (instr[0] & 0x0c) >> 2;
511 else if (instr[0] == 0xf1 && (instr[1] & 0xf0) == 0xd0)
513 int dN = instr[1] & 0x03;
514 int aM = (instr[1] & 0x0c) >> 2;
521 else if (instr[0] == 0xf1 && (instr[1] & 0xf0) == 0xe0)
523 int aN = instr[1] & 0x03;
524 int dM = (instr[1] & 0x0c) >> 2;
531 else if (instr[0] == 0xf8 && instr[1] == 0xfe)
546 after_last_frame_setup_insn = pc;
549 else if (instr[0] == 0xfa && instr[1] == 0xfe)
563 after_last_frame_setup_insn = pc;
566 else if (instr[0] == 0xfc && instr[1] == 0xfe)
581 after_last_frame_setup_insn = pc;
584 else if ((instr[0] & 0xfc) == 0x20)
589 aN = instr[0] & 0x03;
598 else if (instr[0] == 0xfa && (instr[1] & 0xfc) == 0xd0)
604 aN = instr[1] & 0x03;
619 else if (instr[0] == 0xfc && (instr[1] & 0xfc) == 0xd0)
625 aN = instr[1] & 0x03;
638 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x30)
643 Y = (instr[1] & 0x02) >> 1;
649 sM = (buf[0] & 0xf0) >> 4;
659 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x34)
664 Y = (instr[1] & 0x02) >> 1;
670 sM = (buf[0] & 0xf0) >> 4;
679 else if (instr[0] == 0xfb && instr[1] == 0x37)
681 int fsM, sM, Z, rN, rI;
689 rI = (buf[0] & 0xf0) >> 4;
691 sM = (buf[1] & 0xf0) >> 4;
692 Z = (buf[1] & 0x02) >> 1;
702 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x30)
708 Y = (instr[1] & 0x02) >> 1;
714 sM = (buf[0] & 0xf0) >> 4;
725 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x30)
731 Y = (instr[1] & 0x02) >> 1;
737 sM = (buf[0] & 0xf0) >> 4;
748 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x30)
754 Y = (instr[1] & 0x02) >> 1;
760 sM = (buf[0] & 0xf0) >> 4;
771 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x34)
777 Y = (instr[1] & 0x02) >> 1;
783 sM = (buf[0] & 0xf0) >> 4;
793 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x34)
799 Y = (instr[1] & 0x02) >> 1;
805 sM = (buf[0] & 0xf0) >> 4;
815 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x34)
821 Y = (instr[1] & 0x02) >> 1;
827 sM = (buf[0] & 0xf0) >> 4;
837 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x31)
839 int fsM, sM, Y, rN, rN_regnum;
842 Y = (instr[1] & 0x02) >> 1;
848 sM = (buf[0] & 0xf0) >> 4;
854 stack.
store (regs[rN_regnum], 4,
861 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x31)
863 int fsM, sM, Y, rN, rN_regnum;
867 Y = (instr[1] & 0x02) >> 1;
873 sM = (buf[0] & 0xf0) >> 4;
886 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x31)
888 int fsM, sM, Y, rN, rN_regnum;
892 Y = (instr[1] & 0x02) >> 1;
898 sM = (buf[0] & 0xf0) >> 4;
911 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x31)
913 int fsM, sM, Y, rN, rN_regnum;
917 Y = (instr[1] & 0x02) >> 1;
923 sM = (buf[0] & 0xf0) >> 4;
936 else if ((instr[0] & 0xf0) == 0x90)
938 int aN = instr[0] & 0x03;
947 else if ((instr[0] & 0xfc) == 0x24)
949 int aN = instr[0] & 0x03;
962 else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xdc))
964 int aN = instr[1] & 0x03;
977 else if ((instr[0] & 0xf0) == 0x80)
979 int dN = instr[0] & 0x03;
988 else if ((instr[0] & 0xfc) == 0x2c)
990 int dN = instr[0] & 0x03;
1003 else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xcc))
1005 int dN = instr[1] & 0x03;
1039 result->prologue_end = after_last_frame_setup_insn;
1065 void **this_prologue_cache)
1067 if (!*this_prologue_cache)
1079 stop_addr = func_start;
1082 func_start, stop_addr,
1084 *this_prologue_cache));
1127 void **this_prologue_cache,
1131 this_prologue_cache),
1136 static struct value *
1138 void **this_prologue_cache,
int regnum)
1204 struct value *target_func,
1207 int nargs,
struct value **args,
1216 int stack_offset = 0;
1230 for (len = 0, argnum = 0; argnum < nargs; argnum++)
1233 while (regs_used < 2 && arg_len > 0)
1236 arg_len -= push_size;
1253 for (argnum = 0; argnum < nargs; argnum++)
1260 arg_len = push_size;
1272 while (regs_used < 2 && arg_len > 0)
1277 arg_len -= push_size;
1284 arg_len -= push_size;
1286 stack_offset += push_size;
1327 if (sp != unwound_sp)
1329 sp - (unwound_sp - sp));
1349 static int dwarf2_to_gdb[] = {
1373 || dwarf2 >= ARRAY_SIZE (dwarf2_to_gdb))
1376 return dwarf2_to_gdb[dwarf2];
1397 case bfd_mach_mn10300:
1407 case bfd_mach_am33_2:
1415 _(
"mn10300_gdbarch_init: Unknown mn10300 variant"));
1436 mn10300_breakpoint::kind_from_pc);
1438 mn10300_breakpoint::bp_from_kind);
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
static const char * mn10300_generic_register_name(struct gdbarch *gdbarch, int reg)
CORE_ADDR get_frame_pc(struct frame_info *frame)
void set_gdbarch_fp0_regnum(struct gdbarch *gdbarch, int fp0_regnum)
void gdbarch_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
pv_t pv_add_constant(pv_t v, CORE_ADDR k)
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)
typedef BP_MANIPULATION(mn10300_break_insn)
void set_gdbarch_write_pc(struct gdbarch *gdbarch, gdbarch_write_pc_ftype write_pc)
static void check_for_saved(void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
int pv_is_register(pv_t a, int r)
void * memset(T *s, int c, size_t n)=delete
void internal_error(const char *file, int line, const char *fmt,...)
static void mn10300_dump_tdep(struct gdbarch *gdbarch, struct ui_file *file)
static struct mn10300_prologue * mn10300_analyze_frame_prologue(struct frame_info *this_frame, void **this_prologue_cache)
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
static void mn10300_store_return_value(struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
const struct bfd_arch_info * bfd_arch_info
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
#define TYPE_FIELD_TYPE(thistype, n)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
struct frame_info::@60 this_id
pv_t pv_constant(CORE_ADDR k)
#define FRAME_OBSTACK_ZALLOC(TYPE)
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
static struct frame_id mn10300_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
void gdbarch_register(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init, gdbarch_dump_tdep_ftype *dump_tdep)
static CORE_ADDR mn10300_read_pc(struct regcache *regcache)
int reg_offset[MN10300_MAX_NUM_REGS]
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
struct type * check_typedef(struct type *type)
static CORE_ADDR mn10300_unwind_sp(struct gdbarch *gdbarch, struct frame_info *this_frame)
const gdb_byte * value_contents(struct value *value)
constexpr gdb_byte mn10300_break_insn[]
struct value::@186::@187 reg
#define AM33_MODE(gdbarch)
static void mn10300_frame_this_id(struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id)
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)
static int mn10300_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, int dwarf2)
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
static struct type * mn10300_register_type(struct gdbarch *gdbarch, int reg)
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
static int mn10300_type_align(struct type *type)
static void mn10300_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR start_pc, CORE_ADDR limit_pc, struct mn10300_prologue *result)
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)
static const struct frame_unwind mn10300_frame_unwind
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
static int mn10300_use_struct_convention(struct type *type)
void store(pv_t addr, CORE_ADDR size, pv_t value)
void scan(void(*func)(void *closure, pv_t addr, CORE_ADDR size, pv_t value), void *closure)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
void set_gdbarch_read_pc(struct gdbarch *gdbarch, gdbarch_read_pc_ftype read_pc)
int gdbarch_addr_bit(struct gdbarch *gdbarch)
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
struct frame_info * create_new_frame(CORE_ADDR addr, CORE_ADDR pc)
static void mn10300_frame_unwind_init(struct gdbarch *gdbarch)
static CORE_ADDR mn10300_push_dummy_call(struct gdbarch *gdbarch, struct value *target_func, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
void _initialize_mn10300_tdep(void)
static enum return_value_convention mn10300_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static const char * am33_register_name(struct gdbarch *gdbarch, int reg)
static const char * register_name(int reg, const char **regs, long sizeof_regs)
static int translate_rreg(int rreg)
void regcache_raw_write_part(struct regcache *regcache, int regnum, int offset, int len, const gdb_byte *buf)
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
static CORE_ADDR mn10300_frame_base(struct frame_info *this_frame, void **this_prologue_cache)
void set_gdbarch_char_signed(struct gdbarch *gdbarch, int char_signed)
static struct gdbarch * mn10300_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
static struct value * mn10300_frame_prev_register(struct frame_info *this_frame, void **this_prologue_cache, int regnum)
#define TYPE_CODE(thistype)
enum register_status regcache_raw_read(struct regcache *regcache, int regnum, gdb_byte *buf)
struct value * frame_unwind_got_register(struct frame_info *frame, int regnum, int new_regnum)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
CORE_ADDR find_function_addr(struct value *function, struct type **retval_type)
static CORE_ADDR mn10300_unwind_pc(struct gdbarch *gdbarch, struct frame_info *this_frame)
#define TYPE_NFIELDS(thistype)
static void mn10300_extract_return_value(struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf)
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
static void mn10300_write_pc(struct regcache *regcache, CORE_ADDR val)
static LONGEST extract_signed_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
#define MN10300_MAX_NUM_REGS
static CORE_ADDR mn10300_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
unsigned long long ULONGEST
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
int register_size(struct gdbarch *gdbarch, int regnum)
struct type * value_type(const struct value *value)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
#define TYPE_LENGTH(thistype)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype push_dummy_call)
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
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)
CORE_ADDR value_address(const struct value *value)
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
pv_t pv_add(pv_t a, pv_t b)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
CORE_ADDR get_frame_func(struct frame_info *this_frame)
pv_t pv_register(int reg, CORE_ADDR k)
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)
#define MN10300_MAX_REGISTER_SIZE
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
static const char * am33_2_register_name(struct gdbarch *gdbarch, int reg)
struct type * builtin_int
void regcache_raw_write(struct regcache *regcache, int regnum, const gdb_byte *buf)