41 #define MN10300_MAX_NUM_REGS 64
109 while (align < falign)
182 else if (len <= 2 * regsz)
187 len - regsz, valbuf + regsz);
191 _(
"Cannot store return value %d bytes long."), len);
211 memcpy (valbuf, buf, len);
213 else if (len <= 2 * regsz)
216 memcpy (valbuf, buf, regsz);
219 memcpy ((
char *) valbuf + regsz, buf, len - regsz);
223 _(
"Cannot extract return value %d bytes long."), len);
260 static char *regs[] =
261 {
"d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
262 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"",
"",
263 "",
"",
"",
"",
"",
"",
"",
"",
264 "",
"",
"",
"",
"",
"",
"",
"fp"
273 static char *regs[] =
274 {
"d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
275 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"",
276 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
277 "ssp",
"msp",
"usp",
"mcrh",
"mcrl",
"mcvf",
"",
"",
""
285 static char *regs[] =
287 "d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
288 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"mdrq",
"r0",
289 "r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
"ssp",
290 "msp",
"usp",
"mcrh",
"mcrl",
"mcvf",
"fpcr",
"",
"",
291 "fs0",
"fs1",
"fs2",
"fs3",
"fs4",
"fs5",
"fs6",
"fs7",
292 "fs8",
"fs9",
"fs10",
"fs11",
"fs12",
"fs13",
"fs14",
"fs15",
293 "fs16",
"fs17",
"fs18",
"fs19",
"fs20",
"fs21",
"fs22",
"fs23",
294 "fs24",
"fs25",
"fs26",
"fs27",
"fs28",
"fs29",
"fs30",
"fs31"
326 static const unsigned char *
352 if (rreg > 7 && rreg < 12)
354 else if (rreg > 11 && rreg < 16)
392 CORE_ADDR after_last_frame_setup_insn = start_pc;
395 memset (result, 0,
sizeof (*result));
415 while (pc < limit_pc)
428 if (instr[0] == 0xcf)
432 save_mask = instr[1];
479 after_last_frame_setup_insn = pc;
482 else if ((instr[0] & 0xfc) == 0x3c)
484 int aN = instr[0] & 0x03;
490 after_last_frame_setup_insn = pc;
493 else if ((instr[0] & 0xf0) == 0x90
494 && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
496 int aN = instr[0] & 0x03;
497 int aM = (instr[0] & 0x0c) >> 2;
504 else if ((instr[0] & 0xf0) == 0x80
505 && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
507 int dN = instr[0] & 0x03;
508 int dM = (instr[0] & 0x0c) >> 2;
515 else if (instr[0] == 0xf1 && (instr[1] & 0xf0) == 0xd0)
517 int dN = instr[1] & 0x03;
518 int aM = (instr[1] & 0x0c) >> 2;
525 else if (instr[0] == 0xf1 && (instr[1] & 0xf0) == 0xe0)
527 int aN = instr[1] & 0x03;
528 int dM = (instr[1] & 0x0c) >> 2;
535 else if (instr[0] == 0xf8 && instr[1] == 0xfe)
550 after_last_frame_setup_insn = pc;
553 else if (instr[0] == 0xfa && instr[1] == 0xfe)
567 after_last_frame_setup_insn = pc;
570 else if (instr[0] == 0xfc && instr[1] == 0xfe)
585 after_last_frame_setup_insn = pc;
588 else if ((instr[0] & 0xfc) == 0x20)
593 aN = instr[0] & 0x03;
602 else if (instr[0] == 0xfa && (instr[1] & 0xfc) == 0xd0)
608 aN = instr[1] & 0x03;
623 else if (instr[0] == 0xfc && (instr[1] & 0xfc) == 0xd0)
629 aN = instr[1] & 0x03;
642 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x30)
647 Y = (instr[1] & 0x02) >> 1;
653 sM = (buf[0] & 0xf0) >> 4;
663 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x34)
668 Y = (instr[1] & 0x02) >> 1;
674 sM = (buf[0] & 0xf0) >> 4;
683 else if (instr[0] == 0xfb && instr[1] == 0x37)
685 int fsM, sM, Z, rN, rI;
693 rI = (buf[0] & 0xf0) >> 4;
695 sM = (buf[1] & 0xf0) >> 4;
696 Z = (buf[1] & 0x02) >> 1;
707 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x30)
713 Y = (instr[1] & 0x02) >> 1;
719 sM = (buf[0] & 0xf0) >> 4;
731 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x30)
737 Y = (instr[1] & 0x02) >> 1;
743 sM = (buf[0] & 0xf0) >> 4;
755 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x30)
761 Y = (instr[1] & 0x02) >> 1;
767 sM = (buf[0] & 0xf0) >> 4;
779 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x34)
785 Y = (instr[1] & 0x02) >> 1;
791 sM = (buf[0] & 0xf0) >> 4;
802 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x34)
808 Y = (instr[1] & 0x02) >> 1;
814 sM = (buf[0] & 0xf0) >> 4;
825 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x34)
831 Y = (instr[1] & 0x02) >> 1;
837 sM = (buf[0] & 0xf0) >> 4;
848 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x31)
850 int fsM, sM, Y, rN, rN_regnum;
853 Y = (instr[1] & 0x02) >> 1;
859 sM = (buf[0] & 0xf0) >> 4;
872 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x31)
874 int fsM, sM, Y, rN, rN_regnum;
878 Y = (instr[1] & 0x02) >> 1;
884 sM = (buf[0] & 0xf0) >> 4;
897 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x31)
899 int fsM, sM, Y, rN, rN_regnum;
903 Y = (instr[1] & 0x02) >> 1;
909 sM = (buf[0] & 0xf0) >> 4;
922 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x31)
924 int fsM, sM, Y, rN, rN_regnum;
928 Y = (instr[1] & 0x02) >> 1;
934 sM = (buf[0] & 0xf0) >> 4;
947 else if ((instr[0] & 0xf0) == 0x90)
949 int aN = instr[0] & 0x03;
958 else if ((instr[0] & 0xfc) == 0x24)
960 int aN = instr[0] & 0x03;
973 else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xdc))
975 int aN = instr[1] & 0x03;
988 else if ((instr[0] & 0xf0) == 0x80)
990 int dN = instr[0] & 0x03;
999 else if ((instr[0] & 0xfc) == 0x2c)
1001 int dN = instr[0] & 0x03;
1014 else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xcc))
1016 int dN = instr[1] & 0x03;
1078 void **this_prologue_cache)
1080 if (!*this_prologue_cache)
1092 stop_addr = func_start;
1095 func_start, stop_addr, *this_prologue_cache);
1098 return *this_prologue_cache;
1138 void **this_prologue_cache,
1142 this_prologue_cache),
1147 static struct value *
1149 void **this_prologue_cache,
int regnum)
1217 struct value *target_func,
1220 int nargs,
struct value **args,
1229 int stack_offset = 0;
1242 regs_used = struct_return ? 1 : 0;
1243 for (len = 0, argnum = 0; argnum < nargs; argnum++)
1246 while (regs_used < 2 && arg_len > 0)
1249 arg_len -= push_size;
1266 for (argnum = 0; argnum < nargs; argnum++)
1273 arg_len = push_size;
1284 while (regs_used < 2 && arg_len > 0)
1289 arg_len -= push_size;
1296 arg_len -= push_size;
1298 stack_offset += push_size;
1339 if (sp != unwound_sp)
1341 sp - (unwound_sp - sp));
1361 static int dwarf2_to_gdb[] = {
1369 E_FS0_REGNUM + 0, E_FS0_REGNUM + 1, E_FS0_REGNUM + 2, E_FS0_REGNUM + 3,
1370 E_FS0_REGNUM + 4, E_FS0_REGNUM + 5, E_FS0_REGNUM + 6, E_FS0_REGNUM + 7,
1372 E_FS0_REGNUM + 8, E_FS0_REGNUM + 9, E_FS0_REGNUM + 10, E_FS0_REGNUM + 11,
1373 E_FS0_REGNUM + 12, E_FS0_REGNUM + 13, E_FS0_REGNUM + 14, E_FS0_REGNUM + 15,
1375 E_FS0_REGNUM + 16, E_FS0_REGNUM + 17, E_FS0_REGNUM + 18, E_FS0_REGNUM + 19,
1376 E_FS0_REGNUM + 20, E_FS0_REGNUM + 21, E_FS0_REGNUM + 22, E_FS0_REGNUM + 23,
1378 E_FS0_REGNUM + 24, E_FS0_REGNUM + 25, E_FS0_REGNUM + 26, E_FS0_REGNUM + 27,
1379 E_FS0_REGNUM + 28, E_FS0_REGNUM + 29, E_FS0_REGNUM + 30, E_FS0_REGNUM + 31,
1385 || dwarf2 >= ARRAY_SIZE (dwarf2_to_gdb))
1387 warning (
_(
"Bogus register number in debug info: %d"), dwarf2);
1391 return dwarf2_to_gdb[dwarf2];
1394 static struct gdbarch *
1398 struct gdbarch *gdbarch;
1412 case bfd_mach_mn10300:
1422 case bfd_mach_am33_2:
1430 _(
"mn10300_gdbarch_init: Unknown mn10300 variant"));
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
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)
static void push_reg(pv_t *regs, struct pv_area *stack, int regnum)
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)
void warning(const char *fmt,...)
static char * register_name(int reg, char **regs, long sizeof_regs)
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)
struct cleanup * make_cleanup_free_pv_area(struct pv_area *area)
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 internal_error(const char *file, int line, const char *fmt,...)
static void mn10300_dump_tdep(struct gdbarch *gdbarch, struct ui_file *file)
enum prologue_value_kind kind
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)
pv_t pv_constant(CORE_ADDR k)
#define FRAME_OBSTACK_ZALLOC(TYPE)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
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)
static const unsigned char * mn10300_breakpoint_from_pc(struct gdbarch *gdbarch, CORE_ADDR *bp_addr, int *bp_size)
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)
void initialize_file_ftype(void)
#define AM33_MODE(gdbarch)
static void mn10300_frame_this_id(struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id)
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,...)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
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)
void set_gdbarch_breakpoint_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
void pv_area_store(struct pv_area *area, pv_t addr, CORE_ADDR size, pv_t value)
static int mn10300_use_struct_convention(struct type *type)
initialize_file_ftype _initialize_mn10300_tdep
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 pv_area_scan(struct pv_area *area, void(*func)(void *closure, pv_t addr, CORE_ADDR size, pv_t value), void *closure)
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 int translate_rreg(int rreg)
struct pv_area * make_pv_area(int base_reg, int addr_bit)
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)
#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)
LONGEST extract_signed_integer(const gdb_byte *, int, enum bfd_endian)
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)
struct frame_info::@73 this_id
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)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
void do_cleanups(struct cleanup *old_chain)
void set_gdbarch_print_insn(struct gdbarch *gdbarch, gdbarch_print_insn_ftype print_insn)
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)
const ULONGEST const LONGEST len