27 #include "opcode/rl78.h" 208 #define RL78_SP_ADDR 0xffff8 274 "builtin_type_rl78_psw", 8);
319 static const char *
const reg_names[] =
443 "",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"" 446 return reg_names[regnr];
454 static const char *
const reg_names[] =
578 "",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"" 581 return reg_names[regnr];
628 return addr & 0xffffff;
636 return (addr & 0xffff) | 0xf0000;
684 memcpy (
buffer, rawbuf, 3);
694 int bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
708 int bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
761 memcpy (rawbuf,
buffer, 3);
772 bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
781 int bank, raw_regnum;
784 bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
805 struct rl78_get_opcode_byte_handle
853 _(
"Undefined mapping for opc reg %d"),
870 struct rl78_get_opcode_byte_handle *opcdata
871 = (
struct rl78_get_opcode_byte_handle *) handle;
915 CORE_ADDR after_last_frame_setup_insn = start_pc;
918 memset (result, 0,
sizeof (*result));
933 while (pc < limit_pc)
936 struct rl78_get_opcode_byte_handle opcode_handle;
937 RL78_Opcode_Decoded opc;
939 opcode_handle.pc = pc;
941 &opcode_handle, RL78_ISA_DEFAULT);
942 next_pc = pc + bytes_read;
944 if (opc.id == RLO_sel)
946 bank = opc.op[1].addend;
948 else if (opc.id == RLO_mov
949 && opc.op[0].type == RL78_Operand_PreDec
950 && opc.op[0].reg == RL78_Reg_SP
951 && opc.op[1].type == RL78_Operand_Register)
954 + 2 * (opc.op[1].reg - RL78_Reg_AX);
960 after_last_frame_setup_insn = next_pc;
962 else if (opc.id == RLO_sub
963 && opc.op[0].type == RL78_Operand_Register
964 && opc.op[0].reg == RL78_Reg_SP
965 && opc.op[1].type == RL78_Operand_Immediate)
967 int addend = opc.op[1].addend;
971 after_last_frame_setup_insn = next_pc;
973 else if (opc.id == RLO_mov
974 && opc.size == RL78_Word
975 && opc.op[0].type == RL78_Operand_Register
976 && opc.op[1].type == RL78_Operand_Indirect
982 else if (opc.id == RLO_sub
983 && opc.size == RL78_Word
984 && opc.op[0].type == RL78_Operand_Register
985 && opc.op[1].type == RL78_Operand_Immediate)
987 int addend = opc.op[1].addend;
992 else if (opc.id == RLO_mov
993 && opc.size == RL78_Word
994 && opc.op[0].type == RL78_Operand_Indirect
996 && opc.op[1].type == RL78_Operand_Register)
1000 after_last_frame_setup_insn = next_pc;
1018 result->prologue_end = after_last_frame_setup_insn;
1026 return addr & 0xffffff;
1103 void **this_prologue_cache)
1105 if (!*this_prologue_cache)
1117 stop_addr = func_start;
1142 void **this_prologue_cache,
struct frame_id *this_id)
1145 this_prologue_cache),
1151 static struct value *
1153 void **this_prologue_cache,
int regnum)
1208 if (0 <=
reg &&
reg <= 31)
1251 struct value *
function,
1252 struct type *valtype,
1260 if (valtype_len > 8)
1270 while (valtype_len > 0)
1292 while (valtype_len > 0)
1347 for (i = nargs - 1; i >= 0; i--)
1351 int container_len = (len + 1) & ~1;
1353 sp -= container_len;
1389 if (info.
abfd != NULL
1390 && bfd_get_flavour (info.
abfd) == bfd_target_elf_flavour)
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)
static const struct frame_unwind rl78_unwind
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int bit, const char *name)
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)
void set_gdbarch_addr_bits_remove(struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype addr_bits_remove)
struct type * value_enclosing_type(const struct value *value)
static CORE_ADDR rl78_unwind_sp(struct gdbarch *arch, struct frame_info *next_frame)
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 * memset(T *s, int c, size_t n)=delete
void internal_error(const char *file, int line, const char *fmt,...)
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)
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)
constexpr gdb_byte rl78_break_insn[]
#define FRAME_OBSTACK_ZALLOC(TYPE)
#define TYPE_CODE_SPACE(t)
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, const char *name)
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)
struct type * arch_flags_type(struct gdbarch *gdbarch, const char *name, int bit)
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]
struct value::@186::@187 reg
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)
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)
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)
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)
typedef BP_MANIPULATION(rl78_break_insn)
#define gdb_assert_not_reached(message)
struct type * rl78_data_pointer
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)
struct type * arch_pointer_type(struct gdbarch *gdbarch, int bit, const char *name, struct type *target_type)
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
static int opc_reg_to_gdb_regnum(int opcreg)
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)
void store(pv_t addr, CORE_ADDR size, pv_t value)
static CORE_ADDR rl78_make_instruction_address(CORE_ADDR addr)
void scan(void(*func)(void *closure, pv_t addr, CORE_ADDR size, pv_t value), void *closure)
void append_flags_type_flag(struct type *type, int bitpos, const char *name)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
static CORE_ADDR rl78_make_data_address(CORE_ADDR addr)
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)
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 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)
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)
void _initialize_rl78_tdep(void)
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)
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)
static struct type * rl78_psw_type(struct gdbarch *gdbarch)
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)
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)
static CORE_ADDR rl78_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
void regcache_raw_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
void set_gdbarch_vbit_in_delta(struct gdbarch *gdbarch, int vbit_in_delta)