33#include "sim/sim-bfin.h"
44#define P_LINKAGE 0xE800
45#define P_MINUS_SP1 0x0140
46#define P_MINUS_SP2 0x05C0
47#define P_MINUS_SP3 0x0540
48#define P_MINUS_SP4 0x04C0
49#define P_SP_PLUS 0x6C06
50#define P_P2_LOW 0xE10A
51#define P_P2_HIGH 0XE14A
52#define P_SP_EQ_SP_PLUS_P2 0X5BB2
53#define P_SP_EQ_P2_PLUS_SP 0x5B96
54#define P_MINUS_MINUS_SP_EQ_RETS 0x0167
58#define P_16_BIT_INSR_MAX 0xBFFF
60#define P_32_BIT_INSR_MIN 0xC000
62#define P_32_BIT_INSR_MAX 0xE801
64#define P_JUMP_PREG_MIN 0x0050
66#define P_JUMP_PREG_MAX 0x0057
68#define P_JUMP_PC_PLUS_PREG_MIN 0x0080
70#define P_JUMP_PC_PLUS_PREG_MAX 0x0087
72#define P_JUMP_S_MIN 0x2000
74#define P_JUMP_S_MAX 0x2FFF
76#define P_JUMP_L_MIN 0xE200
78#define P_JUMP_L_MAX 0xE2FF
80#define P_IF_CC_JUMP_MIN 0x1800
82#define P_IF_CC_JUMP_MAX 0x1BFF
84#define P_IF_CC_JUMP_BP_MIN 0x1C00
86#define P_IF_CC_JUMP_BP_MAX 0x1FFF
88#define P_IF_NOT_CC_JUMP_MIN 0x1000
90#define P_IF_NOT_CC_JUMP_MAX 0x13FF
92#define P_IF_NOT_CC_JUMP_BP_MIN 0x1400
94#define P_IF_NOT_CC_JUMP_BP_MAX 0x17FF
96#define P_CALL_PREG_MIN 0x0060
98#define P_CALL_PREG_MAX 0x0067
100#define P_CALL_PC_PLUS_PREG_MIN 0x0070
102#define P_CALL_PC_PLUS_PREG_MAX 0x0077
104#define P_CALL_MIN 0xE300
106#define P_CALL_MAX 0xE3FF
112#define P_EXCPT_MIN 0x00A0
114#define P_EXCPT_MAX 0x00AF
116#define P_BIT_MULTI_INS_1 0xC000
118#define P_BIT_MULTI_INS_2 0x0800
121#define UPPER_LIMIT 40
124#define ASTAT_CC_POS 5
125#define ASTAT_CC (1 << ASTAT_CC_POS)
131 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
132 "p0",
"p1",
"p2",
"p3",
"p4",
"p5",
"sp",
"fp",
133 "i0",
"i1",
"i2",
"i3",
"m0",
"m1",
"m2",
"m3",
134 "b0",
"b1",
"b2",
"b3",
"l0",
"l1",
"l2",
"l3",
135 "a0x",
"a0w",
"a1x",
"a1w",
"astat",
"rets",
136 "lc0",
"lt0",
"lb0",
"lc1",
"lt1",
"lb1",
"cycles",
"cycles2",
137 "usp",
"seqstat",
"syscfg",
"reti",
"retx",
"retn",
"rete",
141#define NUM_BFIN_REGNAMES ARRAY_SIZE (bfin_register_name_strings)
245#define BFIN_MAX_REGISTER_SIZE 4
303 if (cache->
base == 0)
350 if (cache->
base == 0)
408 CORE_ADDR orig_pc = pc;
441 else if (op ==
P_RTS)
454 warning (_(
"Function Prologue not recognised; "
455 "pc will point to ENTRY_POINT of the function"));
496 struct value *function,
503 CORE_ADDR struct_addr)
507 long reg_r0, reg_r1, reg_r2;
510 for (i = nargs - 1; i >= 0; i--)
512 struct type *value_type = args[i]->enclosing_type ();
514 total_len += align_up (value_type->
length (), 4);
522 sp -= 12 - total_len;
526 for (i = nargs - 1; i >= 0; i--)
528 struct type *value_type = args[i]->enclosing_type ();
530 int container_len = align_up (arg_type->
length (), 4);
533 write_memory (sp, args[i]->contents ().data (), container_len);
584 if ((iw & 0xf000) >= 0xc000)
593static const gdb_byte *
596 static unsigned char bfin_breakpoint[] = {0xa1, 0x00, 0x00, 0x00};
597 static unsigned char bfin_sim_breakpoint[] = {0x25, 0x00, 0x00, 0x00};
602 return bfin_sim_breakpoint;
604 return bfin_breakpoint;
614 bfd_byte *valbuf = dst;
619 gdb_assert (len <= 8);
638 const bfd_byte *valbuf = src;
647 gdb_assert (len <= 8);
665 struct value *function,
669 const gdb_byte *writebuf)
691static enum register_status
693 int regnum, gdb_byte *buffer)
696 enum register_status
status;
699 internal_error (_(
"invalid register number %d"),
regnum);
705 buffer[1] = buffer[2] = buffer[3] = 0;
713 int regnum,
const gdb_byte *buffer)
718 internal_error (_(
"invalid register number %d"),
regnum);
722 buf[0] = (buf[0] & ~ASTAT_CC) | ((buffer[0] & 1) <<
ASTAT_CC_POS);
739 return cache->
base - 4;
747 return cache->
base + 8;
761 return align_down (address, 4);
768 return tdep->bfin_abi;
792 = gdbarch_tdep<bfin_gdbarch_tdep> (
arches->gdbarch);
794 if (tdep->bfin_abi != abi)
804 tdep->bfin_abi = abi;
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)
static const struct frame_base bfin_frame_base
static CORE_ADDR bfin_frame_local_address(frame_info_ptr this_frame, void **this_cache)
static struct bfin_frame_cache * bfin_frame_cache(frame_info_ptr this_frame, void **this_cache)
#define P_JUMP_PC_PLUS_PREG_MAX
static enum register_status bfin_pseudo_register_read(struct gdbarch *gdbarch, readable_regcache *regcache, int regnum, gdb_byte *buffer)
#define P_JUMP_PC_PLUS_PREG_MIN
static enum return_value_convention bfin_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
#define BFIN_MAX_REGISTER_SIZE
static CORE_ADDR bfin_frame_align(struct gdbarch *gdbarch, CORE_ADDR address)
static int is_minus_minus_sp(int op)
void _initialize_bfin_tdep()
static struct type * bfin_register_type(struct gdbarch *gdbarch, int regnum)
static const int map_gcc_gdb[]
static CORE_ADDR bfin_frame_args_address(frame_info_ptr this_frame, void **this_cache)
static CORE_ADDR bfin_frame_base_address(frame_info_ptr this_frame, void **this_cache)
static CORE_ADDR bfin_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 void bfin_pseudo_register_write(struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const gdb_byte *buffer)
static const char * bfin_register_name(struct gdbarch *gdbarch, int i)
static struct bfin_frame_cache * bfin_alloc_frame_cache(void)
static void bfin_extract_return_value(struct type *type, struct regcache *regs, gdb_byte *dst)
static void bfin_frame_this_id(frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
static const struct frame_unwind bfin_frame_unwind
static struct gdbarch * bfin_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
static const char *const bfin_register_name_strings[]
static void bfin_store_return_value(struct type *type, struct regcache *regs, const gdb_byte *src)
#define P_MINUS_MINUS_SP_EQ_RETS
static int bfin_reg_to_regnum(struct gdbarch *gdbarch, int reg)
static const gdb_byte * bfin_sw_breakpoint_from_kind(struct gdbarch *gdbarch, int kind, int *size)
static CORE_ADDR bfin_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
static int bfin_breakpoint_kind_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static struct value * bfin_frame_prev_register(frame_info_ptr this_frame, void **this_cache, int regnum)
#define BFIN_NUM_PSEUDO_REGS
enum register_status raw_read(int regnum, gdb_byte *buf)
void cooked_write(int regnum, const 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)
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)
@ 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)
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_ps_regnum(struct gdbarch *gdbarch, int ps_regnum)
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_frame_align(struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align)
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value)
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
void set_gdbarch_believe_pcc_promotion(struct gdbarch *gdbarch, int believe_pcc_promotion)
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)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
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_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)
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call)
void set_gdbarch_frame_args_skip(struct gdbarch *gdbarch, CORE_ADDR frame_args_skip)
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, gdbarch_tdep_up tdep)
std::unique_ptr< gdbarch_tdep_base > gdbarch_tdep_up
function_call_return_method
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct type * check_typedef(struct type *type)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
void gdbarch_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
CORE_ADDR saved_regs[BFIN_NUM_REGS]
struct type * builtin_func_ptr
struct type * builtin_data_ptr
struct type * builtin_int32
const char * target_shortname()