Skip to content

Commit 8746327

Browse files
danielhbMichael Tokarev
authored andcommitted
riscv, gdbstub.c: fix reg_width in ricsv_gen_dynamic_vector_feature()
Commit 33a2491 changed 'reg_width' to use 'vlenb', i.e. vector length in bytes, when in this context we want 'reg_width' as the length in bits. Fix 'reg_width' back to the value in bits like 7cb5992 ("target/riscv/gdbstub.c: use 'vlenb' instead of shifting 'vlen'") set beforehand. While we're at it, rename 'reg_width' to 'bitsize' to provide a bit more clarity about what the variable represents. 'bitsize' is also used in riscv_gen_dynamic_csr_feature() with the same purpose, i.e. as an input to gdb_feature_builder_append_reg(). Cc: Akihiko Odaki <[email protected]> Cc: Alex Bennée <[email protected]> Reported-by: Robin Dapp <[email protected]> Fixes: 33a2491 ("target/riscv: Use GDBFeature for dynamic XML") Signed-off-by: Daniel Henrique Barboza <[email protected]> Reviewed-by: LIU Zhiwei <[email protected]> Acked-by: Alex Bennée <[email protected]> Reviewed-by: Akihiko Odaki <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Cc: qemu-stable <[email protected]> Message-ID: <[email protected]> Signed-off-by: Alistair Francis <[email protected]> (cherry picked from commit 583edc4) Signed-off-by: Michael Tokarev <[email protected]>
1 parent e532fdb commit 8746327

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

target/riscv/gdbstub.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static GDBFeature *riscv_gen_dynamic_csr_feature(CPUState *cs, int base_reg)
288288
static GDBFeature *ricsv_gen_dynamic_vector_feature(CPUState *cs, int base_reg)
289289
{
290290
RISCVCPU *cpu = RISCV_CPU(cs);
291-
int reg_width = cpu->cfg.vlenb;
291+
int bitsize = cpu->cfg.vlenb << 3;
292292
GDBFeatureBuilder builder;
293293
int i;
294294

@@ -298,7 +298,7 @@ static GDBFeature *ricsv_gen_dynamic_vector_feature(CPUState *cs, int base_reg)
298298

299299
/* First define types and totals in a whole VL */
300300
for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) {
301-
int count = reg_width / vec_lanes[i].size;
301+
int count = bitsize / vec_lanes[i].size;
302302
gdb_feature_builder_append_tag(
303303
&builder, "<vector id=\"%s\" type=\"%s\" count=\"%d\"/>",
304304
vec_lanes[i].id, vec_lanes[i].gdb_type, count);
@@ -316,7 +316,7 @@ static GDBFeature *ricsv_gen_dynamic_vector_feature(CPUState *cs, int base_reg)
316316
/* Define vector registers */
317317
for (i = 0; i < 32; i++) {
318318
gdb_feature_builder_append_reg(&builder, g_strdup_printf("v%d", i),
319-
reg_width, i, "riscv_vector", "vector");
319+
bitsize, i, "riscv_vector", "vector");
320320
}
321321

322322
gdb_feature_builder_end(&builder);

0 commit comments

Comments
 (0)