@@ -623,6 +623,10 @@ typedef enum {
#define PRV_RESERVED 2
#define PRV_M 3
+/* Share virtualization mode as part of priv register */
+#define PRV_V (1 << 8)
+
+
/* RV32 satp CSR field masks */
#define SATP32_MODE 0x80000000
#define SATP32_ASID 0x7fc00000
@@ -212,8 +212,14 @@ static int riscv_gdb_get_virtual(CPUState *cs, GByteArray
*buf, int n)
#else
RISCVCPU *cpu = RISCV_CPU(cs);
CPURISCVState *env = &cpu->env;
+ target_ulong ret = env->priv;
- return gdb_get_regl(buf, env->priv);
+ /* include virtualization mode */
+
+ if (env->virt_enabled) {
+ ret |= PRV_V;
+ }
+ return gdb_get_regl(buf, ret);
#endif
}