[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 54/89] target/riscv: Use PRV_RESERVED instead of PRV_H
|
From: |
Alistair Francis |
|
Subject: |
[PULL 54/89] target/riscv: Use PRV_RESERVED instead of PRV_H |
|
Date: |
Fri, 5 May 2023 11:02:06 +1000 |
From: Weiwei Li <liweiwei@iscas.ac.cn>
PRV_H has no real meaning, but just a reserved privilege mode currently.
Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230407014743.18779-3-liweiwei@iscas.ac.cn>
[ Changes by AF:
- Convert one missing use of PRV_H
]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/cpu.h | 2 +-
target/riscv/cpu_bits.h | 2 +-
target/riscv/cpu_helper.c | 2 +-
target/riscv/gdbstub.c | 2 +-
target/riscv/op_helper.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index f47c3fc139..86e08d10da 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -684,7 +684,7 @@ static inline RISCVMXL cpu_recompute_xl(CPURISCVState *env)
case PRV_U:
xl = get_field(env->mstatus, MSTATUS64_UXL);
break;
- default: /* PRV_S | PRV_H */
+ default: /* PRV_S */
xl = get_field(env->mstatus, MSTATUS64_SXL);
break;
}
diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h
index 101702cb4a..a16bfaf43f 100644
--- a/target/riscv/cpu_bits.h
+++ b/target/riscv/cpu_bits.h
@@ -608,7 +608,7 @@ typedef enum {
/* Privilege modes */
#define PRV_U 0
#define PRV_S 1
-#define PRV_H 2 /* Reserved */
+#define PRV_RESERVED 2
#define PRV_M 3
/* RV32 satp CSR field masks */
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index 2310c7905f..29ac7956f7 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -650,7 +650,7 @@ void riscv_cpu_set_mode(CPURISCVState *env, target_ulong
newpriv)
if (newpriv > PRV_M) {
g_assert_not_reached();
}
- if (newpriv == PRV_H) {
+ if (newpriv == PRV_RESERVED) {
newpriv = PRV_U;
}
if (icount_enabled() && newpriv != env->priv) {
diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c
index fa537aed74..524bede865 100644
--- a/target/riscv/gdbstub.c
+++ b/target/riscv/gdbstub.c
@@ -203,7 +203,7 @@ static int riscv_gdb_set_virtual(CPURISCVState *cs, uint8_t
*mem_buf, int n)
if (n == 0) {
#ifndef CONFIG_USER_ONLY
cs->priv = ldtul_p(mem_buf) & 0x3;
- if (cs->priv == PRV_H) {
+ if (cs->priv == PRV_RESERVED) {
cs->priv = PRV_S;
}
#endif
diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c
index b8a03afebb..bd21c6eeef 100644
--- a/target/riscv/op_helper.c
+++ b/target/riscv/op_helper.c
@@ -141,7 +141,7 @@ static void check_zicbo_envcfg(CPURISCVState *env,
target_ulong envbits,
}
if (env->virt_enabled &&
- (((env->priv < PRV_H) && !get_field(env->henvcfg, envbits)) ||
+ (((env->priv <= PRV_S) && !get_field(env->henvcfg, envbits)) ||
((env->priv < PRV_S) && !get_field(env->senvcfg, envbits)))) {
riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, ra);
}
--
2.40.0
- [PULL 45/89] target/riscv: remove cpu->cfg.ext_u, (continued)
- [PULL 45/89] target/riscv: remove cpu->cfg.ext_u, Alistair Francis, 2023/05/04
- [PULL 44/89] target/riscv: remove cpu->cfg.ext_s, Alistair Francis, 2023/05/04
- [PULL 46/89] target/riscv: remove cpu->cfg.ext_h, Alistair Francis, 2023/05/04
- [PULL 48/89] target/riscv: remove cpu->cfg.ext_v, Alistair Francis, 2023/05/04
- [PULL 49/89] target/riscv: remove riscv_cpu_sync_misa_cfg(), Alistair Francis, 2023/05/04
- [PULL 47/89] target/riscv: remove cpu->cfg.ext_j, Alistair Francis, 2023/05/04
- [PULL 51/89] target/riscv: add RVG and remove cpu->cfg.ext_g, Alistair Francis, 2023/05/04
- [PULL 52/89] target/riscv/cpu.c: redesign register_cpu_props(), Alistair Francis, 2023/05/04
- [PULL 50/89] target/riscv: remove cfg.ext_g setup from rv64_thead_c906_cpu_init(), Alistair Francis, 2023/05/04
- [PULL 53/89] target/riscv: Fix the mstatus.MPP value after executing MRET, Alistair Francis, 2023/05/04
- [PULL 54/89] target/riscv: Use PRV_RESERVED instead of PRV_H,
Alistair Francis <=
- [PULL 55/89] target/riscv: Legalize MPP value in write_mstatus, Alistair Francis, 2023/05/04
- [PULL 56/89] target/riscv: Use check for relationship between Zdinx/Zhinx{min} and Zfinx, Alistair Francis, 2023/05/04
- [PULL 60/89] target/riscv: Encode the FS and VS on a normal way for tb flags, Alistair Francis, 2023/05/04
- [PULL 61/89] target/riscv: Remove mstatus_hs_{fs, vs} from tb_flags, Alistair Francis, 2023/05/04
- [PULL 58/89] target/riscv: Extract virt enabled state from tb flags, Alistair Francis, 2023/05/04
- [PULL 57/89] target/riscv: fix H extension TVM trap, Alistair Francis, 2023/05/04
- [PULL 59/89] target/riscv: Add a general status enum for extensions, Alistair Francis, 2023/05/04
- [PULL 62/89] target/riscv: Add a tb flags field for vstart, Alistair Francis, 2023/05/04
- [PULL 63/89] target/riscv: Separate priv from mmu_idx, Alistair Francis, 2023/05/04
- [PULL 65/89] target/riscv: Use cpu_ld*_code_mmu for HLVX, Alistair Francis, 2023/05/04