aboutsummaryrefslogtreecommitdiff
path: root/target/riscv
diff options
context:
space:
mode:
authorSylvain Pelissier <sylvain.pelissier@gmail.com>2021-01-06 21:41:41 +0100
committerAlistair Francis <alistair.francis@wdc.com>2021-01-16 10:57:21 -0800
commitedf647864bdab84ed4b1a4f47ea05be6bb075c69 (patch)
tree8d65d5c060d356978eafc18c4e1e62d4c16cd6e6 /target/riscv
parent465ef47abe3fd0722cf50a6073ccd9520bdbee95 (diff)
downloadqemu-edf647864bdab84ed4b1a4f47ea05be6bb075c69.zip
qemu-edf647864bdab84ed4b1a4f47ea05be6bb075c69.tar.gz
qemu-edf647864bdab84ed4b1a4f47ea05be6bb075c69.tar.bz2
gdb: riscv: Add target description
Target description is not currently implemented in RISC-V architecture. Thus GDB won't set it properly when attached. The patch implements the target description response. Signed-off-by: Sylvain Pelissier <sylvain.pelissier@gmail.com> Reviewed-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20210106204141.14027-1-sylvain.pelissier@gmail.com Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv')
-rw-r--r--target/riscv/cpu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 8227d7a..6aafe4e 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -557,6 +557,18 @@ static Property riscv_cpu_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
+static gchar *riscv_gdb_arch_name(CPUState *cs)
+{
+ RISCVCPU *cpu = RISCV_CPU(cs);
+ CPURISCVState *env = &cpu->env;
+
+ if (riscv_cpu_is_32bit(env)) {
+ return g_strdup("riscv:rv32");
+ } else {
+ return g_strdup("riscv:rv64");
+ }
+}
+
static void riscv_cpu_class_init(ObjectClass *c, void *data)
{
RISCVCPUClass *mcc = RISCV_CPU_CLASS(c);
@@ -592,6 +604,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
/* For now, mark unmigratable: */
cc->vmsd = &vmstate_riscv_cpu;
#endif
+ cc->gdb_arch_name = riscv_gdb_arch_name;
#ifdef CONFIG_TCG
cc->tcg_initialize = riscv_translate_init;
cc->tlb_fill = riscv_cpu_tlb_fill;