35 *reason = (edmsw >> 12) & 0x0F;
65 if (enable_watchpoint)
70 if (syscall_break->
is_set) {
75 syscall_break->
is_set =
false;
79 if (value_pc == syscall_break->
address)
91 if (enable_watchpoint)
118 if (enable_watchpoint) {
139 uint32_t syscall_address;
143 entry_size = 0x4 << (((value_ir3 >> 14) & 0x3) << 1);
144 syscall_address = (value_ir3 & 0xFFFF0000) + entry_size * 8;
155 syscall_id = (value_ir6 >> 16) & 0x7FFF;
162 uint32_t value_dimbr;
171 uint32_t backup_bpa, backup_bpam, backup_bpc;
199 syscall_break->
address = syscall_address;
201 syscall_break->
is_set =
true;
209 uint32_t *
address, uint32_t reason)
211 LOG_DEBUG(
"nds32_v3_get_exception_address");
218 uint32_t match_count;
220 static int32_t number_of_hard_break;
223 if (number_of_hard_break == 0) {
225 number_of_hard_break = (edm_cfg & 0x7) + 1;
231 match_bits = (edmsw >> 4) & 0xFF;
233 for (i = 0 ; i < number_of_hard_break ; i++) {
234 if (match_bits & (1 << i)) {
241 if (0x3 == (bp_control & 0x3)) {
248 if (match_count > 1) {
251 }
else if (match_count == 1) {
271 LOG_DEBUG(
"PC: 0x%08" PRIx32
", access start: 0x%08" PRIx32
", end: 0x%08" PRIx32,
275 uint32_t in_range_watch_count = 0;
279 in_range_watch_count++;
281 if (in_range_watch_count > 1) {
291 uint32_t watch_start;
310 }
else if (match_count == 0) {
328 *address = 0xFFFFFFFF;
376 uint32_t exception_address;
382 if (exception_address == 0xFFFFFFFF)
385 if (exception_address == 0) {
386 scan_all_watchpoint.
address = 0;
388 scan_all_watchpoint.
next = 0;
391 *hit_watchpoint = &scan_all_watchpoint;
396 if (((exception_address ^ wp->
address) & (~wp->
mask)) == 0) {
397 *hit_watchpoint = wp;
467 address = physical_address;
525 address = physical_address;
587 address = physical_address;
645 address = physical_address;
#define CHECK_RETVAL(action)
#define LOG_WARNING(expr ...)
#define LOG_DEBUG(expr ...)
int nds32_examine_debug_reason(struct nds32 *nds32)
int nds32_config(struct nds32 *nds32)
int nds32_full_context(struct nds32 *nds32)
int nds32_read_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int nds32_get_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t *value)
int nds32_restore_context(struct target *target)
Restore the processor context on an Andes target.
int nds32_write_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int nds32_gdb_fileio_write_memory(struct nds32 *nds32, uint32_t address, uint32_t size, const uint8_t *buffer)
int nds32_init_arch_info(struct target *target, struct nds32 *nds32)
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_init(struct nds32 *nds32)
Holds the interface to Andes cores.
static struct nds32 * target_to_nds32(struct target *target)
Convert target handle to generic Andes target state handle.
@ NDS32_DEBUG_DATA_ADDR_WATCHPOINT_NEXT_PRECISE
@ NDS32_DEBUG_LOAD_STORE_GLOBAL_STOP
@ NDS32_DEBUG_DATA_VALUE_WATCHPOINT_NEXT_PRECISE
static struct aice_port_s * target_to_aice(struct target *target)
int aice_execute(struct aice_port_s *aice, uint32_t *instructions, uint32_t instruction_num)
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_step(struct aice_port_s *aice)
static int aice_write_register(struct aice_port_s *aice, uint32_t num, uint32_t val)
static int aice_memory_access(struct aice_port_s *aice, enum nds_memory_access a_access)
int nds32_evaluate_opcode(struct nds32 *nds32, uint32_t opcode, uint32_t address, struct nds32_instruction *instruction)
int nds32_read_opcode(struct nds32 *nds32, uint32_t address, uint32_t *value)
int nds32_v3_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static int nds32_v3_get_debug_reason(struct nds32 *nds32, uint32_t *reason)
static struct nds32_v3_common_callback * v3_common_callback
static int nds32_v3_register_mapping(struct nds32 *nds32, int reg_no)
int nds32_v3_init_target(struct command_context *cmd_ctx, struct target *target)
static int nds32_v3_leave_debug_state(struct nds32 *nds32, bool enable_watchpoint)
Restore processor state.
static int nds32_v3_debug_entry(struct nds32 *nds32, bool enable_watchpoint)
Save processor state.
int nds32_v3_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)
int nds32_v3_target_create_common(struct target *target, struct nds32 *nds32)
int nds32_v3_checksum_memory(struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)
int nds32_v3_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
static int nds32_v3_get_exception_address(struct nds32 *nds32, uint32_t *address, uint32_t reason)
int nds32_v3_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int nds32_v3_target_request_data(struct target *target, uint32_t size, uint8_t *buffer)
target_type functions:
int nds32_v3_hit_watchpoint(struct target *target, struct watchpoint **hit_watchpoint)
find out which watchpoint hits get exception address and compare the address to watchpoints
void nds32_v3_common_register_callback(struct nds32_v3_common_callback *callback)
int nds32_v3_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
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
int line_size
cache line size
bool enable
enable cache or not
enum nds_memory_access access_channel
Memory access method.
struct nds32_cache dcache
DCache.
int(* deactivate_hardware_watchpoint)(struct target *target)
int(* activate_hardware_breakpoint)(struct target *target)
int(* check_interrupt_stack)(struct nds32 *nds32)
int(* deactivate_hardware_breakpoint)(struct target *target)
int(* restore_interrupt_stack)(struct nds32 *nds32)
int(* activate_hardware_watchpoint)(struct target *target)
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.
int(* register_map)(struct nds32 *nds32, int reg_no)
Register mappings.
struct nds32_memory memory
Memory information.
bool hit_syscall
Flag reporting whether continue/step hits syscall or not.
bool global_stop
Flag reporting whether global stop is active.
bool virtual_hosting
Flag reporting whether virtual hosting is active.
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.
struct breakpoint syscall_break
int(* enter_debug_state)(struct nds32 *nds32, bool enable_watchpoint)
Backup target registers may be modified in debug state.
int(* virt2phys)(struct target *target, target_addr_t address, target_addr_t *physical)
struct gdb_fileio_info * fileio_info
struct target_type * type
struct watchpoint * watchpoints
int target_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
Remove the breakpoint for target.
int target_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add the breakpoint for target.
#define ERROR_TARGET_NOT_HALTED