#include "target/target.h"
#include "target/algorithm.h"
#include "target/target_type.h"
+#include <target/smp.h>
#include "jtag/jtag.h"
#include "target/register.h"
#include "target/breakpoints.h"
int result = ERROR_OK;
if (target->smp) {
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ struct target_list *tlist;
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
if (halt_prep(t) != ERROR_OK)
result = ERROR_FAIL;
}
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
riscv_info_t *i = riscv_info(t);
if (i->prepped) {
}
}
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
if (halt_finish(t) != ERROR_OK)
return ERROR_FAIL;
LOG_DEBUG("handle_breakpoints=%d", handle_breakpoints);
int result = ERROR_OK;
if (target->smp && !single_hart) {
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ struct target_list *tlist;
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
if (resume_prep(t, current, address, handle_breakpoints,
debug_execution) != ERROR_OK)
result = ERROR_FAIL;
}
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
riscv_info_t *i = riscv_info(t);
if (i->prepped) {
}
}
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
if (resume_finish(t) != ERROR_OK)
return ERROR_FAIL;
unsigned halts_discovered = 0;
unsigned should_remain_halted = 0;
unsigned should_resume = 0;
- unsigned i = 0;
- for (struct target_list *list = target->head; list;
- list = list->next, i++) {
+ struct target_list *list;
+ foreach_smp_target(list, target->smp_targets) {
struct target *t = list->target;
riscv_info_t *r = riscv_info(t);
enum riscv_poll_hart out = riscv_poll_hart(t, r->current_hartid);
}
/* Sample memory if any target is running. */
- for (struct target_list *list = target->head; list;
- list = list->next, i++) {
+ foreach_smp_target(list, target->smp_targets) {
struct target *t = list->target;
if (t->state == TARGET_RUNNING) {
sample_memory(target);