OpenOCD
nds32_v3.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2013 Andes Technology *
5  * Hsiangkai Wang <hkwang@andestech.com> *
6  ***************************************************************************/
7 
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11 
12 #include "breakpoints.h"
13 #include "nds32_cmd.h"
14 #include "nds32_aice.h"
15 #include "nds32_v3.h"
16 #include "nds32_v3_common.h"
17 
19 {
20  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
21  struct aice_port_s *aice = target_to_aice(target);
22  struct breakpoint *bp;
23  int32_t hbr_index = nds32_v3->next_hbr_index;
24 
25  for (bp = target->breakpoints; bp; bp = bp->next) {
26  if (bp->type == BKPT_SOFT) {
27  /* already set at nds32_v3_add_breakpoint() */
28  continue;
29  } else if (bp->type == BKPT_HARD) {
30  hbr_index--;
31  /* set address */
32  aice_write_debug_reg(aice, NDS_EDM_SR_BPA0 + hbr_index, bp->address);
33  /* set mask */
34  aice_write_debug_reg(aice, NDS_EDM_SR_BPAM0 + hbr_index, 0);
35  /* set value */
36  aice_write_debug_reg(aice, NDS_EDM_SR_BPV0 + hbr_index, 0);
37 
38  if (nds32_v3->nds32.memory.address_translation)
39  /* enable breakpoint (virtual address) */
40  aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + hbr_index, 0x2);
41  else
42  /* enable breakpoint (physical address) */
43  aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + hbr_index, 0xA);
44 
45  LOG_DEBUG("Add hardware BP %" PRId32 " at %08" TARGET_PRIxADDR, hbr_index,
46  bp->address);
47  } else {
48  return ERROR_FAIL;
49  }
50  }
51 
52  return ERROR_OK;
53 }
54 
56 {
57  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
58  struct aice_port_s *aice = target_to_aice(target);
59  struct breakpoint *bp;
60  int32_t hbr_index = nds32_v3->next_hbr_index;
61 
62  for (bp = target->breakpoints; bp; bp = bp->next) {
63  if (bp->type == BKPT_SOFT) {
64  continue;
65  } else if (bp->type == BKPT_HARD) {
66  hbr_index--;
67  /* disable breakpoint */
68  aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + hbr_index, 0x0);
69  } else {
70  return ERROR_FAIL;
71  }
72 
73  LOG_DEBUG("Remove hardware BP %" PRId32 " at %08" TARGET_PRIxADDR, hbr_index,
74  bp->address);
75  }
76 
77  return ERROR_OK;
78 }
79 
81 {
82  struct aice_port_s *aice = target_to_aice(target);
83  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
84  struct watchpoint *wp;
85  int32_t wp_num = 0;
86  uint32_t wp_config = 0;
87  bool ld_stop, st_stop;
88 
89  if (nds32_v3->nds32.global_stop)
90  ld_stop = st_stop = false;
91 
92  for (wp = target->watchpoints; wp; wp = wp->next) {
93 
94  if (wp_num < nds32_v3->used_n_wp) {
95  wp->mask = wp->length - 1;
96  if ((wp->address % wp->length) != 0)
97  wp->mask = (wp->mask << 1) + 1;
98 
99  if (wp->rw == WPT_READ)
100  wp_config = 0x3;
101  else if (wp->rw == WPT_WRITE)
102  wp_config = 0x5;
103  else if (wp->rw == WPT_ACCESS)
104  wp_config = 0x7;
105 
106  /* set/unset physical address bit of BPCn according to PSW.DT */
107  if (nds32_v3->nds32.memory.address_translation == false)
108  wp_config |= 0x8;
109 
110  /* set address */
111  aice_write_debug_reg(aice, NDS_EDM_SR_BPA0 + wp_num,
112  wp->address - (wp->address % wp->length));
113  /* set mask */
114  aice_write_debug_reg(aice, NDS_EDM_SR_BPAM0 + wp_num, wp->mask);
115  /* enable watchpoint */
116  aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + wp_num, wp_config);
117  /* set value */
118  aice_write_debug_reg(aice, NDS_EDM_SR_BPV0 + wp_num, 0);
119 
120  LOG_DEBUG("Add hardware watchpoint %" PRId32 " at %08" TARGET_PRIxADDR " mask %08" PRIx32,
121  wp_num, wp->address, wp->mask);
122 
123  wp_num++;
124  } else if (nds32_v3->nds32.global_stop) {
125  if (wp->rw == WPT_READ)
126  ld_stop = true;
127  else if (wp->rw == WPT_WRITE)
128  st_stop = true;
129  else if (wp->rw == WPT_ACCESS)
130  ld_stop = st_stop = true;
131  }
132  }
133 
134  if (nds32_v3->nds32.global_stop) {
135  uint32_t edm_ctl;
136  aice_read_debug_reg(aice, NDS_EDM_SR_EDM_CTL, &edm_ctl);
137  if (ld_stop)
138  edm_ctl |= 0x10;
139  if (st_stop)
140  edm_ctl |= 0x20;
142  }
143 
144  return ERROR_OK;
145 }
146 
148 {
149  struct aice_port_s *aice = target_to_aice(target);
150  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
151  int32_t wp_num = 0;
152  struct watchpoint *wp;
153  bool clean_global_stop = false;
154 
155  for (wp = target->watchpoints; wp; wp = wp->next) {
156 
157  if (wp_num < nds32_v3->used_n_wp) {
158  /* disable watchpoint */
159  aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + wp_num, 0x0);
160 
161  LOG_DEBUG("Remove hardware watchpoint %" PRId32 " at %08" TARGET_PRIxADDR
162  " mask %08" PRIx32, wp_num,
163  wp->address, wp->mask);
164  wp_num++;
165  } else if (nds32_v3->nds32.global_stop) {
166  clean_global_stop = true;
167  }
168  }
169 
170  if (clean_global_stop) {
171  uint32_t edm_ctl;
172  aice_read_debug_reg(aice, NDS_EDM_SR_EDM_CTL, &edm_ctl);
173  edm_ctl = edm_ctl & (~0x30);
175  }
176 
177  return ERROR_OK;
178 }
179 
181 {
182  uint32_t val_ir0;
183  uint32_t value;
184 
185  /* Save interrupt level */
186  nds32_get_mapped_reg(nds32, IR0, &val_ir0);
187  nds32->current_interrupt_level = (val_ir0 >> 1) & 0x3;
188 
190  LOG_ERROR("<-- TARGET ERROR! Reaching the max interrupt stack level %" PRIu32 ". -->",
192 
193  /* backup $ir4 & $ir6 to avoid suppressed exception overwrite */
196 
197  return ERROR_OK;
198 }
199 
201 {
202  uint32_t value;
203 
204  /* get backup value from cache */
205  /* then set back to make the register dirty */
208 
211 
214 
215  return ERROR_OK;
216 }
217 
219 {
220  int retval;
221  struct aice_port_s *aice = target_to_aice(target);
222  bool switch_to_v3_stack = false;
223  uint32_t value_edm_ctl;
224 
225  aice_read_debug_reg(aice, NDS_EDM_SR_EDM_CTL, &value_edm_ctl);
226  if (((value_edm_ctl >> 6) & 0x1) == 0) { /* reset to V2 EDM mode */
227  aice_write_debug_reg(aice, NDS_EDM_SR_EDM_CTL, value_edm_ctl | (0x1 << 6));
228  aice_read_debug_reg(aice, NDS_EDM_SR_EDM_CTL, &value_edm_ctl);
229  if (((value_edm_ctl >> 6) & 0x1) == 1)
230  switch_to_v3_stack = true;
231  } else
232  switch_to_v3_stack = false;
233 
235 
236  if (target->state != TARGET_HALTED) {
237  /* reset only */
238  LOG_WARNING("%s: ran after reset and before halt ...",
240  retval = target_halt(target);
241  if (retval != ERROR_OK)
242  return retval;
243 
244  } else {
245  /* reset-halt */
246  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
247  struct nds32 *nds32 = &(nds32_v3->nds32);
248  uint32_t value;
249  uint32_t interrupt_level;
250 
251  if (switch_to_v3_stack == true) {
252  /* PSW.INTL-- */
253  nds32_get_mapped_reg(nds32, IR0, &value);
254  interrupt_level = (value >> 1) & 0x3;
255  interrupt_level--;
256  value &= ~(0x6);
257  value |= (interrupt_level << 1);
258  value |= 0x400; /* set PSW.DEX */
259  nds32_set_mapped_reg(nds32, IR0, value);
260 
261  /* copy IPC to OIPC */
262  if ((interrupt_level + 1) < nds32->max_interrupt_level) {
263  nds32_get_mapped_reg(nds32, IR9, &value);
265  }
266  }
267  }
268 
269  return ERROR_OK;
270 }
271 
273  struct breakpoint *breakpoint)
274 {
275  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
276  struct nds32 *nds32 = &(nds32_v3->nds32);
277  int result;
278 
279  if (breakpoint->type == BKPT_HARD) {
280  /* check hardware resource */
281  if (nds32_v3->n_hbr <= nds32_v3->next_hbr_index) {
282  LOG_WARNING("<-- TARGET WARNING! Insert too many "
283  "hardware breakpoints/watchpoints! "
284  "The limit of combined hardware "
285  "breakpoints/watchpoints is %" PRId32 ". -->",
286  nds32_v3->n_hbr);
287  LOG_WARNING("<-- TARGET STATUS: Inserted number of "
288  "hardware breakpoint: %" PRId32 ", hardware "
289  "watchpoints: %" PRId32 ". -->",
290  nds32_v3->next_hbr_index - nds32_v3->used_n_wp,
291  nds32_v3->used_n_wp);
293  }
294 
295  /* update next place to put hardware breakpoint */
296  nds32_v3->next_hbr_index++;
297 
298  /* hardware breakpoint insertion occurs before 'continue' actually */
299  return ERROR_OK;
300  } else if (breakpoint->type == BKPT_SOFT) {
302  if (result != ERROR_OK) {
303  /* auto convert to hardware breakpoint if failed */
304  if (nds32->auto_convert_hw_bp) {
305  /* convert to hardware breakpoint */
307 
309  }
310  }
311 
312  return result;
313  } else /* unrecognized breakpoint type */
314  return ERROR_FAIL;
315 
316  return ERROR_OK;
317 }
318 
320  struct breakpoint *breakpoint)
321 {
322  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
323 
324  if (breakpoint->type == BKPT_HARD) {
325  if (nds32_v3->next_hbr_index <= 0)
326  return ERROR_FAIL;
327 
328  /* update next place to put hardware breakpoint */
329  nds32_v3->next_hbr_index--;
330 
331  /* hardware breakpoint removal occurs after 'halted' actually */
332  return ERROR_OK;
333  } else if (breakpoint->type == BKPT_SOFT) {
335  } else /* unrecognized breakpoint type */
336  return ERROR_FAIL;
337 
338  return ERROR_OK;
339 }
340 
342  struct watchpoint *watchpoint)
343 {
344  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
345 
346  /* check hardware resource */
347  if (nds32_v3->n_hbr <= nds32_v3->next_hbr_index) {
348  /* No hardware resource */
349  if (nds32_v3->nds32.global_stop) {
350  LOG_WARNING("<-- TARGET WARNING! The number of "
351  "watchpoints exceeds the hardware "
352  "resources. Stop at every load/store "
353  "instruction to check for watchpoint matches. -->");
354  return ERROR_OK;
355  }
356 
357  LOG_WARNING("<-- TARGET WARNING! Insert too many hardware "
358  "breakpoints/watchpoints! The limit of combined "
359  "hardware breakpoints/watchpoints is %" PRId32 ". -->",
360  nds32_v3->n_hbr);
361  LOG_WARNING("<-- TARGET STATUS: Inserted number of "
362  "hardware breakpoint: %" PRId32 ", hardware "
363  "watchpoints: %" PRId32 ". -->",
364  nds32_v3->next_hbr_index - nds32_v3->used_n_wp,
365  nds32_v3->used_n_wp);
366 
368  }
369 
370  /* update next place to put hardware watchpoint */
371  nds32_v3->next_hbr_index++;
372  nds32_v3->used_n_wp++;
373 
374  return ERROR_OK;
375 }
376 
378  struct watchpoint *watchpoint)
379 {
380  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
381 
382  if (nds32_v3->next_hbr_index <= 0) {
383  if (nds32_v3->nds32.global_stop)
384  return ERROR_OK;
385 
386  return ERROR_FAIL;
387  }
388 
389  /* update next place to put hardware breakpoint */
390  nds32_v3->next_hbr_index--;
391  nds32_v3->used_n_wp--;
392 
393  return ERROR_OK;
394 }
395 
398  .restore_interrupt_stack = nds32_v3_restore_interrupt_stack,
399  .activate_hardware_breakpoint = nds32_v3_activate_hardware_breakpoint,
400  .activate_hardware_watchpoint = nds32_v3_activate_hardware_watchpoint,
401  .deactivate_hardware_breakpoint = nds32_v3_deactivate_hardware_breakpoint,
402  .deactivate_hardware_watchpoint = nds32_v3_deactivate_hardware_watchpoint,
403 };
404 
405 static int nds32_v3_target_create(struct target *target, Jim_Interp *interp)
406 {
407  struct nds32_v3_common *nds32_v3;
408 
409  nds32_v3 = calloc(1, sizeof(*nds32_v3));
410  if (!nds32_v3)
411  return ERROR_FAIL;
412 
415 
416  return ERROR_OK;
417 }
418 
419 /* talk to the target and set things up */
420 static int nds32_v3_examine(struct target *target)
421 {
422  struct nds32_v3_common *nds32_v3 = target_to_nds32_v3(target);
423  struct nds32 *nds32 = &(nds32_v3->nds32);
424  struct aice_port_s *aice = target_to_aice(target);
425 
426  if (!target_was_examined(target)) {
428 
431  }
432 
433  uint32_t edm_cfg;
434  aice_read_debug_reg(aice, NDS_EDM_SR_EDM_CFG, &edm_cfg);
435 
436  /* get the number of hardware breakpoints */
437  nds32_v3->n_hbr = (edm_cfg & 0x7) + 1;
438 
439  /* low interference profiling */
440  if (edm_cfg & 0x100)
441  nds32_v3->low_interference_profile = true;
442  else
443  nds32_v3->low_interference_profile = false;
444 
445  nds32_v3->next_hbr_index = 0;
446  nds32_v3->used_n_wp = 0;
447 
448  LOG_INFO("%s: total hardware breakpoint %" PRId32, target_name(target),
449  nds32_v3->n_hbr);
450 
453 
455 
456  return ERROR_OK;
457 }
458 
460 struct target_type nds32_v3_target = {
461  .name = "nds32_v3",
462 
463  .poll = nds32_poll,
464  .arch_state = nds32_arch_state,
465 
466  .target_request_data = nds32_v3_target_request_data,
467 
468  .halt = nds32_halt,
469  .resume = nds32_resume,
470  .step = nds32_step,
471 
472  .assert_reset = nds32_assert_reset,
473  .deassert_reset = nds32_v3_deassert_reset,
474 
475  /* register access */
476  .get_gdb_reg_list = nds32_get_gdb_reg_list,
477 
478  /* memory access */
479  .read_buffer = nds32_v3_read_buffer,
480  .write_buffer = nds32_v3_write_buffer,
481  .read_memory = nds32_v3_read_memory,
482  .write_memory = nds32_v3_write_memory,
483 
484  .checksum_memory = nds32_v3_checksum_memory,
485 
486  /* breakpoint/watchpoint */
487  .add_breakpoint = nds32_v3_add_breakpoint,
488  .remove_breakpoint = nds32_v3_remove_breakpoint,
489  .add_watchpoint = nds32_v3_add_watchpoint,
490  .remove_watchpoint = nds32_v3_remove_watchpoint,
491  .hit_watchpoint = nds32_v3_hit_watchpoint,
492 
493  /* MMU */
494  .mmu = nds32_mmu,
495  .virt2phys = nds32_virtual_to_physical,
496  .read_phys_memory = nds32_read_phys_memory,
497  .write_phys_memory = nds32_write_phys_memory,
498 
499  .run_algorithm = nds32_v3_run_algorithm,
500 
501  .commands = nds32_command_handlers,
502  .target_create = nds32_v3_target_create,
503  .init_target = nds32_v3_init_target,
504  .examine = nds32_v3_examine,
505 
506  .get_gdb_fileio_info = nds32_get_gdb_fileio_info,
507  .gdb_fileio_end = nds32_gdb_fileio_end,
508 
509  .profiling = nds32_profiling,
510 };
#define CHECK_RETVAL(action)
Definition: arc.h:246
@ BKPT_HARD
Definition: breakpoints.h:18
@ BKPT_SOFT
Definition: breakpoints.h:19
@ WPT_ACCESS
Definition: breakpoints.h:23
@ WPT_READ
Definition: breakpoints.h:23
@ WPT_WRITE
Definition: breakpoints.h:23
#define LOG_WARNING(expr ...)
Definition: log.h:120
#define ERROR_FAIL
Definition: log.h:161
#define LOG_ERROR(expr ...)
Definition: log.h:123
#define LOG_INFO(expr ...)
Definition: log.h:117
#define LOG_DEBUG(expr ...)
Definition: log.h:109
#define ERROR_OK
Definition: log.h:155
int nds32_poll(struct target *target)
Definition: nds32.c:2061
int nds32_mmu(struct target *target, int *enabled)
Definition: nds32.c:945
int nds32_halt(struct target *target)
Definition: nds32.c:2031
int nds32_gdb_fileio_end(struct target *target, int retcode, int fileio_errno, bool ctrl_c)
Definition: nds32.c:2458
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
Definition: nds32.c:596
int nds32_arch_state(struct target *target)
Definition: nds32.c:964
int nds32_get_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t *value)
Definition: nds32.c:513
int nds32_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info)
Definition: nds32.c:2297
int nds32_edm_config(struct nds32 *nds32)
Definition: nds32.c:1554
int nds32_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
Definition: nds32.c:1750
int nds32_read_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Definition: nds32.c:812
int nds32_add_software_breakpoint(struct target *target, struct breakpoint *breakpoint)
Definition: nds32.c:1431
int nds32_profiling(struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
Definition: nds32.c:2474
int nds32_virtual_to_physical(struct target *target, target_addr_t address, target_addr_t *physical)
Definition: nds32.c:1662
int nds32_write_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Definition: nds32.c:921
int nds32_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
Definition: nds32.c:2104
int nds32_set_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t value)
set register internally
Definition: nds32.c:532
int nds32_assert_reset(struct target *target)
Definition: nds32.c:2176
int nds32_remove_software_breakpoint(struct target *target, struct breakpoint *breakpoint)
Definition: nds32.c:1469
int nds32_reset_halt(struct nds32 *nds32)
Definition: nds32.c:2605
static bool nds32_reach_max_interrupt_level(struct nds32 *nds32)
Definition: nds32.h:441
static struct aice_port_s * target_to_aice(struct target *target)
Definition: nds32.h:429
static int aice_write_debug_reg(struct aice_port_s *aice, uint32_t addr, const uint32_t val)
Definition: nds32_aice.h:85
static int aice_read_debug_reg(struct aice_port_s *aice, uint32_t addr, uint32_t *val)
Definition: nds32_aice.h:79
const struct command_registration nds32_command_handlers[]
Definition: nds32_cmd.c:1114
@ NDS_EDM_SR_BPV0
Definition: nds32_edm.h:56
@ NDS_EDM_SR_BPAM0
Definition: nds32_edm.h:48
@ NDS_EDM_SR_EDM_CTL
Definition: nds32_edm.h:74
@ NDS_EDM_SR_BPA0
Definition: nds32_edm.h:40
@ NDS_EDM_SR_BPC0
Definition: nds32_edm.h:32
@ NDS_EDM_SR_EDM_CFG
Definition: nds32_edm.h:72
@ IR6
Definition: nds32_reg.h:67
@ IR9
Definition: nds32_reg.h:70
@ IR4
Definition: nds32_reg.h:65
@ IR0
Definition: nds32_reg.h:61
@ IR11
Definition: nds32_reg.h:72
static int nds32_v3_deactivate_hardware_watchpoint(struct target *target)
Definition: nds32_v3.c:147
static int nds32_v3_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
Definition: nds32_v3.c:272
static int nds32_v3_activate_hardware_breakpoint(struct target *target)
Definition: nds32_v3.c:18
static int nds32_v3_deactivate_hardware_breakpoint(struct target *target)
Definition: nds32_v3.c:55
static int nds32_v3_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
Definition: nds32_v3.c:319
static int nds32_v3_target_create(struct target *target, Jim_Interp *interp)
Definition: nds32_v3.c:405
static int nds32_v3_activate_hardware_watchpoint(struct target *target)
Definition: nds32_v3.c:80
static int nds32_v3_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
Definition: nds32_v3.c:341
static int nds32_v3_examine(struct target *target)
Definition: nds32_v3.c:420
static int nds32_v3_restore_interrupt_stack(struct nds32 *nds32)
Definition: nds32_v3.c:200
static int nds32_v3_deassert_reset(struct target *target)
Definition: nds32_v3.c:218
static int nds32_v3_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
Definition: nds32_v3.c:377
struct target_type nds32_v3_target
Holds methods for Andes1337 targets.
Definition: nds32_v3.c:460
static int nds32_v3_check_interrupt_stack(struct nds32 *nds32)
Definition: nds32_v3.c:180
static struct nds32_v3_common * target_to_nds32_v3(struct target *target)
Definition: nds32_v3.h:29
int nds32_v3_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int nds32_v3_init_target(struct command_context *cmd_ctx, struct target *target)
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)
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)
struct breakpoint * next
Definition: breakpoints.h:34
enum breakpoint_type type
Definition: breakpoints.h:30
target_addr_t address
Definition: breakpoints.h:27
bool address_translation
Address translation.
Definition: nds32.h:164
int(* check_interrupt_stack)(struct nds32 *nds32)
struct nds32 nds32
Definition: nds32_v3.h:14
int32_t used_n_wp
number of used hardware watchpoints
Definition: nds32_v3.h:20
bool low_interference_profile
low interference profiling
Definition: nds32_v3.h:26
int32_t next_hbr_index
next hardware breakpoint index
Definition: nds32_v3.h:23
int32_t n_hbr
number of hardware breakpoints
Definition: nds32_v3.h:17
Represents a generic Andes core.
Definition: nds32.h:226
struct target * target
Backpointer to the target.
Definition: nds32.h:346
bool auto_convert_hw_bp
Flag to indicate if auto convert software breakpoints to hardware breakpoints or not in ROM.
Definition: nds32.h:340
bool reset_halt_as_examine
reset-halt as target examine
Definition: nds32.h:296
struct nds32_memory memory
Memory information.
Definition: nds32.h:235
bool global_stop
Flag reporting whether global stop is active.
Definition: nds32.h:290
uint32_t max_interrupt_level
maximum interrupt level
Definition: nds32.h:265
uint32_t current_interrupt_level
current interrupt level
Definition: nds32.h:268
This holds methods shared between all instances of a given target type.
Definition: target_type.h:26
const char * name
Name of this type of target.
Definition: target_type.h:31
Definition: target.h:120
enum target_debug_reason debug_reason
Definition: target.h:159
enum target_state state
Definition: target.h:162
struct breakpoint * breakpoints
Definition: target.h:164
struct watchpoint * watchpoints
Definition: target.h:165
enum watchpoint_rw rw
Definition: breakpoints.h:44
uint32_t mask
Definition: breakpoints.h:42
struct watchpoint * next
Definition: breakpoints.h:47
uint32_t value
Definition: breakpoints.h:43
uint32_t length
Definition: breakpoints.h:41
target_addr_t address
Definition: breakpoints.h:40
int target_halt(struct target *target)
Definition: target.c:585
@ DBG_REASON_NOTHALTED
Definition: target.h:78
@ TARGET_HALTED
Definition: target.h:55
@ TARGET_RUNNING
Definition: target.h:54
static const char * target_name(struct target *target)
Returns the instance-specific name of the specified target.
Definition: target.h:234
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
Definition: target.h:796
static void target_set_examined(struct target *target)
Sets the examined flag for the given target.
Definition: target.h:445
static bool target_was_examined(struct target *target)
Definition: target.h:438
#define TARGET_PRIxADDR
Definition: types.h:340