28 if ((cur_level >= 1) && (cur_level < max_level)) {
32 }
else if (reg_no ==
PC) {
36 }
else if ((cur_level >= 2) && (cur_level < max_level)) {
40 }
else if (reg_no ==
R27) {
43 }
else if (reg_no ==
IR1) {
46 }
else if (reg_no ==
IR4) {
49 }
else if (reg_no ==
IR6) {
52 }
else if (reg_no ==
IR9) {
56 }
else if (cur_level == max_level) {
73 *reason = val_itype & 0x0F;
83 int32_t hbr_index = 0;
120 int32_t hbr_index = 0;
146 uint32_t wp_config = 0;
210 uint32_t modified_psw;
221 LOG_ERROR(
"<-- TARGET ERROR! Reaching the max interrupt stack level %" PRIu32
". -->",
225 modified_psw = val_ir0 - 0x2;
228 modified_psw &= (~0x8C1);
244 val_ir2 &= ~(0x01 << 11);
251 modified_psw = val_ir0 | (val_ir1 & 0x80);
278 LOG_WARNING(
"<-- TARGET WARNING! Virtual hosting is not supported "
279 "under V1/V2 architecture. -->");
297 if (enable_watchpoint)
306 if (enable_watchpoint) {
359 if (enable_watchpoint) {
386 LOG_WARNING(
"%s: ran after reset and before halt ...",
414 LOG_WARNING(
"<-- TARGET WARNING! Insert too many hardware "
415 "breakpoints/watchpoints! The limit of "
416 "combined hardware breakpoints/watchpoints "
417 "is %" PRId32
". -->", nds32_v2->
n_hbr);
474 LOG_WARNING(
"<-- TARGET WARNING! Insert too many hardware "
475 "breakpoints/watchpoints! The limit of "
476 "combined hardware breakpoints/watchpoints is %" PRId32
". -->", nds32_v2->
n_hbr);
501 uint32_t *address, uint32_t reason)
519 uint32_t exception_address;
524 scan_all_watchpoint.
address = 0;
526 scan_all_watchpoint.
next = 0;
531 if (exception_address == 0) {
533 *hit_watchpoint = &scan_all_watchpoint;
538 if (((exception_address ^ wp->
address) & (~wp->
mask)) == 0) {
540 *hit_watchpoint = wp;
567 nds32_v2 = calloc(1,
sizeof(*nds32_v2));
612 nds32_v2->
n_hbr = (edm_cfg & 0x7) + 1;
640 *address = physical_address;
#define CHECK_RETVAL(action)
Support functions to access arbitrary bits in a byte array.
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
int nds32_examine_debug_reason(struct nds32 *nds32)
int nds32_poll(struct target *target)
int nds32_config(struct nds32 *nds32)
int nds32_full_context(struct nds32 *nds32)
int nds32_mmu(struct target *target, int *enabled)
int nds32_halt(struct target *target)
int nds32_read_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int nds32_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
get all register list
int nds32_arch_state(struct target *target)
int nds32_restore_context(struct target *target)
Restore the processor context on an Andes target.
int nds32_edm_config(struct nds32 *nds32)
int nds32_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
int nds32_write_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int nds32_read_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int nds32_add_software_breakpoint(struct target *target, struct breakpoint *breakpoint)
int nds32_virtual_to_physical(struct target *target, target_addr_t address, target_addr_t *physical)
int nds32_write_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int nds32_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
int nds32_init_arch_info(struct target *target, struct nds32 *nds32)
int nds32_assert_reset(struct target *target)
int nds32_remove_software_breakpoint(struct target *target, struct breakpoint *breakpoint)
int nds32_read_buffer(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer)
int nds32_write_buffer(struct target *target, uint32_t address, uint32_t size, const uint8_t *buffer)
int nds32_reset_halt(struct nds32 *nds32)
int nds32_init(struct nds32 *nds32)
static struct nds32 * target_to_nds32(struct target *target)
Convert target handle to generic Andes target state handle.
static bool nds32_reach_max_interrupt_level(struct nds32 *nds32)
static struct aice_port_s * target_to_aice(struct target *target)
static int aice_write_debug_reg(struct aice_port_s *aice, uint32_t addr, const uint32_t val)
static int aice_read_debug_reg(struct aice_port_s *aice, uint32_t addr, uint32_t *val)
static int aice_read_register(struct aice_port_s *aice, uint32_t num, uint32_t *val)
static int aice_write_register(struct aice_port_s *aice, uint32_t num, uint32_t val)
const struct command_registration nds32_command_handlers[]
This is the interface to the Embedded Debug Module for Andes cores.
static int nds32_v2_activate_hardware_watchpoint(struct target *target)
static int nds32_v2_checksum_memory(struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)
static int nds32_v2_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
static int nds32_v2_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int nds32_v2_debug_entry(struct nds32 *nds32, bool enable_watchpoint)
Save processor state.
static int nds32_v2_check_interrupt_stack(struct nds32_v2_common *nds32_v2)
static int nds32_v2_target_create(struct target *target, Jim_Interp *interp)
static int nds32_v2_hit_watchpoint(struct target *target, struct watchpoint **hit_watchpoint)
find out which watchpoint hits get exception address and compare the address to watchpoints
static int nds32_v2_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
static int nds32_v2_register_mapping(struct nds32 *nds32, int reg_no)
static int nds32_v2_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
static int nds32_v2_run_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, int timeout_ms, void *arch_info)
static int nds32_v2_examine(struct target *target)
static int nds32_v2_leave_debug_state(struct nds32 *nds32, bool enable_watchpoint)
Restore processor state.
static int nds32_v2_deassert_reset(struct target *target)
static int nds32_v2_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
static int nds32_v2_init_target(struct command_context *cmd_ctx, struct target *target)
static int nds32_v2_get_exception_address(struct nds32 *nds32, uint32_t *address, uint32_t reason)
static int nds32_v2_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static int nds32_v2_get_debug_reason(struct nds32 *nds32, uint32_t *reason)
static int nds32_v2_restore_interrupt_stack(struct nds32_v2_common *nds32_v2)
static int nds32_v2_target_request_data(struct target *target, uint32_t size, uint8_t *buffer)
static int nds32_v2_translate_address(struct target *target, target_addr_t *address)
static int nds32_v2_deactivate_hardware_breakpoint(struct target *target)
static int nds32_v2_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int nds32_v2_deactivate_hardware_watchpoint(struct target *target)
static int nds32_v2_activate_hardware_breakpoint(struct target *target)
static int nds32_v2_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
struct target_type nds32_v2_target
Holds methods for V2 targets.
static struct nds32_v2_common * target_to_nds32_v2(struct target *target)
void register_cache_invalidate(struct reg_cache *cache)
Marks the contents of the register cache as invalid (and clean).
size_t size
Size of the control block search area.
enum breakpoint_type type
enum nds_memory_access access_channel
Memory access method.
bool address_translation
Address translation.
int32_t n_hbr
number of hardware breakpoints
int32_t next_hbr_index
next hardware breakpoint index
Represents a generic Andes core.
bool init_arch_info_after_halted
Flag to indicate register table is ready or not.
struct target * target
Backpointer to the target.
bool auto_convert_hw_bp
Flag to indicate if auto convert software breakpoints to hardware breakpoints or not in ROM.
int(* register_map)(struct nds32 *nds32, int reg_no)
Register mappings.
bool reset_halt_as_examine
reset-halt as target examine
struct nds32_memory memory
Memory information.
bool virtual_hosting
Flag reporting whether virtual hosting is active.
uint32_t max_interrupt_level
maximum interrupt level
struct reg_cache * core_cache
int(* leave_debug_state)(struct nds32 *nds32, bool enable_watchpoint)
Restore target registers may be modified in debug state.
int(* get_debug_reason)(struct nds32 *nds32, uint32_t *reason)
Get debug exception virtual address.
int(* get_watched_address)(struct nds32 *nds32, uint32_t *address, uint32_t reason)
Get address hit watchpoint.
uint32_t current_interrupt_level
current interrupt level
int(* enter_debug_state)(struct nds32 *nds32, bool enable_watchpoint)
Backup target registers may be modified in debug state.
This holds methods shared between all instances of a given target type.
const char * name
Name of this type of target.
int(* virt2phys)(struct target *target, target_addr_t address, target_addr_t *physical)
enum target_debug_reason debug_reason
struct breakpoint * breakpoints
struct target_type * type
struct watchpoint * watchpoints
int target_halt(struct target *target)
#define ERROR_TARGET_NOT_HALTED
static const char * target_name(struct target *target)
Returns the instance-specific name of the specified target.
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
static void target_set_examined(struct target *target)
Sets the examined flag for the given target.
static bool target_was_examined(struct target *target)