aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-01-07 08:48:49 -0800
committerTim Newsome <tim@sifive.com>2019-01-07 08:48:49 -0800
commit4bb8bd005c27c3ee7ac0ee3adb0046428e3f1868 (patch)
tree72f26d2a720e395f363f0c65c0fddd0d92c73c5a
parenta9d436e77fd3945643c4fb1eee4f22c310e94b26 (diff)
downloadriscv-openocd-4bb8bd005c27c3ee7ac0ee3adb0046428e3f1868.zip
riscv-openocd-4bb8bd005c27c3ee7ac0ee3adb0046428e3f1868.tar.gz
riscv-openocd-4bb8bd005c27c3ee7ac0ee3adb0046428e3f1868.tar.bz2
Implement hwthread_get_thread_reg_list.
MulticoreRegTest now gets past the first check on all GPRs. Change-Id: I35f3c51273542668985f7a86965c1e947fc12194
-rw-r--r--src/rtos/hwthread.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/rtos/hwthread.c b/src/rtos/hwthread.c
index 8f826a7..7050ba3 100644
--- a/src/rtos/hwthread.c
+++ b/src/rtos/hwthread.c
@@ -211,7 +211,7 @@ static inline int gdb_reg_pos(struct target *target, int pos, int len)
static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
- struct rtos_reg **reg_list, int *num_regs)
+ struct rtos_reg **rtos_reg_list, int *rtos_reg_list_size)
{
struct target_list *head;
struct target *target;
@@ -238,14 +238,32 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
curr = target;
if (thread_id != threadid_from_target(curr))
return ERROR_FAIL;
-
}
if (!target_was_examined(curr))
return ERROR_FAIL;
- LOG_ERROR("TODO: not implemented");
- return ERROR_FAIL;
+ struct reg **reg_list;
+ int retval = target_get_gdb_reg_list(curr, &reg_list, rtos_reg_list_size,
+ REG_CLASS_GENERAL);
+ if (retval != ERROR_OK)
+ return retval;
+
+ *rtos_reg_list = calloc(*rtos_reg_list_size, sizeof(struct rtos_reg));
+ if (*rtos_reg_list == NULL) {
+ free(reg_list);
+ return ERROR_FAIL;
+ }
+
+ for (int i = 0; i < *rtos_reg_list_size; i++) {
+ (*rtos_reg_list)[i].number = (*reg_list)[i].number;
+ (*rtos_reg_list)[i].size = (*reg_list)[i].size;
+ memcpy((*rtos_reg_list)[i].value, (*reg_list)[i].value,
+ ((*reg_list)[i].size + 7) / 8);
+ }
+ free(reg_list);
+
+ return ERROR_OK;
}
static int hwthread_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])