aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2017-11-10 15:30:52 -0800
committerTim Newsome <tim@sifive.com>2017-12-19 10:41:48 -0800
commitc421fefdcb4c16648e22574afdbc0677675844f8 (patch)
tree359fbd6dd3978e93cf38000b9c304ee3bb78cfd4
parentb8db82fb576690d06082e72a6a81ec3bec99131a (diff)
downloadriscv-openocd-c421fefdcb4c16648e22574afdbc0677675844f8.zip
riscv-openocd-c421fefdcb4c16648e22574afdbc0677675844f8.tar.gz
riscv-openocd-c421fefdcb4c16648e22574afdbc0677675844f8.tar.bz2
Checkpoint that seems to work.
Change-Id: I9599aacc256f6340795097732b6f8e8869c2099f
-rw-r--r--src/target/riscv/riscv-013.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 14a7d26..338c243 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -1179,6 +1179,24 @@ static int init_target(struct command_context *cmd_ctx,
char *reg_name = info->reg_names;
info->reg_values = NULL;
+ static struct reg_feature feature_cpu = {
+ .name = "org.gnu.gdb.riscv.cpu"
+ };
+ static struct reg_feature feature_fpu = {
+ .name = "org.gnu.gdb.riscv.fpu"
+ };
+ static struct reg_feature feature_csr = {
+ .name = "org.gnu.gdb.riscv.csr"
+ };
+ static struct reg_feature feature_virtual = {
+ .name = "org.gnu.gdb.riscv.virtual"
+ };
+
+ static struct reg_data_type type_ieee_single = {
+ .type = REG_TYPE_IEEE_SINGLE,
+ .id = "ieee_single"
+ };
+
for (unsigned int i = 0; i < GDB_REGNO_COUNT; i++) {
struct reg *r = &target->reg_cache->reg_list[i];
r->number = i;
@@ -1190,14 +1208,26 @@ static int init_target(struct command_context *cmd_ctx,
r->arch_info = target;
if (i <= GDB_REGNO_XPR31) {
sprintf(reg_name, "x%d", i);
+ r->group = "general";
+ r->feature = &feature_cpu;
} else if (i == GDB_REGNO_PC) {
sprintf(reg_name, "pc");
+ r->group = "general";
+ r->feature = &feature_cpu;
} else if (i >= GDB_REGNO_FPR0 && i <= GDB_REGNO_FPR31) {
sprintf(reg_name, "f%d", i - GDB_REGNO_FPR0);
+ r->group = "float";
+ r->feature = &feature_fpu;
+ // TODO: check D or F extension
+ r->reg_data_type = &type_ieee_single;
} else if (i >= GDB_REGNO_CSR0 && i <= GDB_REGNO_CSR4095) {
sprintf(reg_name, "csr%d", i - GDB_REGNO_CSR0);
+ r->group = "csr";
+ r->feature = &feature_csr;
} else if (i == GDB_REGNO_PRIV) {
sprintf(reg_name, "priv");
+ r->group = "general";
+ r->feature = &feature_virtual;
}
if (reg_name[0]) {
r->name = reg_name;