27 #include "opcode/rl78.h"
208 #define RL78_SP_ADDR 0xffff8
295 static const char *
const reg_names[] =
419 "",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
422 return reg_names[regnr];
430 static const char *
const reg_names[] =
554 "",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
557 return reg_names[regnr];
604 return addr & 0xffffff;
612 return (addr & 0xffff) | 0xf0000;
660 memcpy (buffer, rawbuf, 3);
670 int bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
684 int bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
737 memcpy (rawbuf, buffer, 3);
748 bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
757 int bank, raw_regnum;
760 bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
837 _(
"Undefined mapping for opc reg %d"),
900 CORE_ADDR after_last_frame_setup_insn = start_pc;
903 memset (result, 0,
sizeof (*result));
919 while (pc < limit_pc)
923 RL78_Opcode_Decoded opc;
925 opcode_handle.
pc =
pc;
927 &opcode_handle, RL78_ISA_DEFAULT);
928 next_pc = pc + bytes_read;
930 if (opc.id == RLO_sel)
932 bank = opc.op[1].addend;
934 else if (opc.id == RLO_mov
935 && opc.op[0].type == RL78_Operand_PreDec
936 && opc.op[0].reg == RL78_Reg_SP
937 && opc.op[1].type == RL78_Operand_Register)
940 + 2 * (opc.op[1].reg - RL78_Reg_AX);
945 pv_area_store (stack, reg[RL78_SP_REGNUM], 1, reg[rsrc + 1]);
946 after_last_frame_setup_insn = next_pc;
948 else if (opc.id == RLO_sub
949 && opc.op[0].type == RL78_Operand_Register
950 && opc.op[0].reg == RL78_Reg_SP
951 && opc.op[1].type == RL78_Operand_Immediate)
953 int addend = opc.op[1].addend;
957 after_last_frame_setup_insn = next_pc;
959 else if (opc.id == RLO_mov
960 && opc.size == RL78_Word
961 && opc.op[0].type == RL78_Operand_Register
962 && opc.op[1].type == RL78_Operand_Indirect
968 else if (opc.id == RLO_sub
969 && opc.size == RL78_Word
970 && opc.op[0].type == RL78_Operand_Register
971 && opc.op[1].type == RL78_Operand_Immediate)
973 int addend = opc.op[1].addend;
978 else if (opc.id == RLO_mov
979 && opc.size == RL78_Word
980 && opc.op[0].type == RL78_Operand_Indirect
982 && opc.op[1].type == RL78_Operand_Register)
986 after_last_frame_setup_insn = next_pc;
1014 return addr & 0xffffff;
1091 void **this_prologue_cache)
1093 if (!*this_prologue_cache)
1105 stop_addr = func_start;
1110 return *this_prologue_cache;
1129 void **this_prologue_cache,
struct frame_id *this_id)
1132 this_prologue_cache),
1138 static struct value *
1140 void **this_prologue_cache,
int regnum)
1151 (frame_base & 0xff));
1155 ((frame_base >> 8) & 0xff));
1195 if (0 <= reg && reg <= 31)
1219 _(
"Undefined dwarf2 register mapping of reg %d"),
1240 struct value *
function,
1241 struct type *valtype,
1249 if (valtype_len > 8)
1259 while (valtype_len > 0)
1281 while (valtype_len > 0)
1336 for (i = nargs - 1; i >= 0; i--)
1340 int container_len = (len + 1) & ~1;
1342 sp -= container_len;
1370 static struct gdbarch *
1373 struct gdbarch *gdbarch;
1378 if (info.
abfd != NULL
1379 && bfd_get_flavour (info.
abfd) == bfd_target_elf_flavour)
1380 elf_flags = elf_elfheader (info.
abfd)->e_flags;
1414 xstrdup (
"rl78_data_addr_t"));
1420 xstrdup (
"rl78_code_addr_t"));
struct gdbarch * target_gdbarch(void)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
static const char * rl78_g10_register_name(struct gdbarch *gdbarch, int regnr)
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)
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)
struct type * rl78_uint16
static CORE_ADDR rl78_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 set_gdbarch_float_bit(struct gdbarch *gdbarch, int float_bit)
void set_gdbarch_dwarf2_addr_size(struct gdbarch *gdbarch, int dwarf2_addr_size)
CORE_ADDR get_frame_pc(struct frame_info *frame)
pv_t pv_add_constant(pv_t v, CORE_ADDR k)
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
static struct rl78_prologue * rl78_analyze_frame_prologue(struct frame_info *this_frame, void **this_prologue_cache)
LONGEST value_as_long(struct value *val)
struct value * frame_unwind_got_memory(struct frame_info *frame, int regnum, CORE_ADDR addr)
struct type * arch_flags_type(struct gdbarch *gdbarch, char *name, int length)
void set_gdbarch_addr_bits_remove(struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype addr_bits_remove)
static CORE_ADDR rl78_unwind_sp(struct gdbarch *arch, struct frame_info *next_frame)
struct cleanup * make_cleanup_free_pv_area(struct pv_area *area)
ULONGEST align_down(ULONGEST v, int n)
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
void set_gdbarch_short_bit(struct gdbarch *gdbarch, int short_bit)
int pv_is_register(pv_t a, int r)
void internal_error(const char *file, int line, const char *fmt,...)
void append_flags_type_flag(struct type *type, int bitpos, char *name)
const gdb_byte * breakpoint
void set_gdbarch_register_reggroup_p(struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype register_reggroup_p)
static void check_for_saved(void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
enum prologue_value_kind kind
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
struct gdbarch_list * next
struct reggroup *const restore_reggroup
struct reggroup *const all_reggroup
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
static CORE_ADDR rl78_unwind_pc(struct gdbarch *arch, struct frame_info *next_frame)
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
#define FRAME_OBSTACK_ZALLOC(TYPE)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
#define TYPE_CODE_SPACE(t)
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
void set_gdbarch_addr_bit(struct gdbarch *gdbarch, int addr_bit)
static int rl78_register_reggroup_p(struct gdbarch *gdbarch, int regnum, struct reggroup *group)
static struct frame_id rl78_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
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)
static void rl78_this_id(struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id)
struct reggroup *const general_reggroup
struct type * rl78_uint32
int reg_offset[RL78_NUM_TOTAL_REGS]
void initialize_file_ftype(void)
static void rl78_pseudo_register_write(struct gdbarch *gdbarch, struct regcache *regcache, int reg, const gdb_byte *buffer)
static int rl78_get_opcode_byte(void *handle)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
initialize_file_ftype _initialize_rl78_tdep
struct reggroup *const system_reggroup
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
void set_gdbarch_address_to_pointer(struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype address_to_pointer)
const gdb_byte * value_contents_all(struct value *value)
#define gdb_assert_not_reached(message)
struct type * rl78_data_pointer
struct type * value_enclosing_type(struct value *value)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
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)
static const gdb_byte * rl78_breakpoint_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
static int opc_reg_to_gdb_regnum(int opcreg)
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 CORE_ADDR rl78_make_instruction_address(CORE_ADDR addr)
static CORE_ADDR rl78_make_data_address(CORE_ADDR addr)
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
static enum register_status rl78_pseudo_register_read(struct gdbarch *gdbarch, struct regcache *regcache, int reg, gdb_byte *buffer)
void set_gdbarch_pointer_to_address(struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype pointer_to_address)
int gdbarch_addr_bit(struct gdbarch *gdbarch)
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, char *name)
static CORE_ADDR rl78_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
static struct value * rl78_prev_register(struct frame_info *this_frame, void **this_prologue_cache, int regnum)
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)
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
static void rl78_analyze_prologue(CORE_ADDR start_pc, CORE_ADDR limit_pc, struct rl78_prologue *result)
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
static CORE_ADDR rl78_frame_align(struct gdbarch *gdbarch, CORE_ADDR sp)
struct pv_area * make_pv_area(int base_reg, int addr_bit)
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
static enum return_value_convention rl78_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
void set_gdbarch_pseudo_register_read(struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype pseudo_register_read)
void set_gdbarch_char_signed(struct gdbarch *gdbarch, int char_signed)
struct type * rl78_psw_type
#define TYPE_TARGET_TYPE(thistype)
static int rl78_dwarf_reg_to_regnum(struct gdbarch *gdbarch, int reg)
static struct type * rl78_register_type(struct gdbarch *gdbarch, int reg_nr)
static int rl78_register_sim_regno(struct gdbarch *gdbarch, int regnum)
#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)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
static CORE_ADDR rl78_pointer_to_address(struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
static struct gdbarch * rl78_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
static void rl78_address_to_pointer(struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr)
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)
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)
void set_gdbarch_long_double_format(struct gdbarch *gdbarch, const struct floatformat **long_double_format)
struct reggroup *const save_reggroup
#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)
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int length, char *name)
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 const char * rl78_register_name(struct gdbarch *gdbarch, int regnr)
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
struct type * rl78_code_pointer
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)
static CORE_ADDR rl78_frame_base(struct frame_info *this_frame, void **this_prologue_cache)
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)
void do_cleanups(struct cleanup *old_chain)
void set_gdbarch_print_insn(struct gdbarch *gdbarch, gdbarch_print_insn_ftype print_insn)
static CORE_ADDR rl78_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
void regcache_raw_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
const ULONGEST const LONGEST len
void set_gdbarch_vbit_in_delta(struct gdbarch *gdbarch, int vbit_in_delta)