Skip to contentSkip to conversation

target/riscv: avoid env_archcpu() in cpu_get_tb_cpu_state()

PATCH Applied Daniel Henrique Barboza 4 participants 4 messages Feb 10, 2023 – Feb 16, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/riscv: avoid env_archcpu() in cpu_get_tb_cpu_state()

We have a RISCVCPU *cpu pointer available at the start of the function.

---
 target/riscv/cpu_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu_helper.c +1 -1
index ad8d82662c..3a9472a2ff 100644
@@ -60,7 +60,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
          * which is not supported by GVEC. So we set vl_eq_vlmax flag to true
          * only when maxsz >= 8 bytes.
          */
-        uint32_t vlmax = vext_get_vlmax(env_archcpu(env), env->vtype);
+        uint32_t vlmax = vext_get_vlmax(cpu, env->vtype);
         uint32_t sew = FIELD_EX64(env->vtype, VTYPE, VSEW);
         uint32_t maxsz = vlmax << sew;
         bool vl_eq_vlmax = (env->vstart == 0) && (vlmax == env->vl) &&
Signature · 1 line
2.39.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Henrique Barboza
Quoted 3 lines · Daniel Henrique Barboza

We have a RISCVCPU *cpu pointer available at the start of the function.

Regards,

Weiwei Li

Quoted 17 lines
---
  target/riscv/cpu_helper.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu_helper.c +1 -1
index ad8d82662c..3a9472a2ff 100644
@@ -60,7 +60,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
           * which is not supported by GVEC. So we set vl_eq_vlmax flag to true
           * only when maxsz >= 8 bytes.
           */
-        uint32_t vlmax = vext_get_vlmax(env_archcpu(env), env->vtype);
+        uint32_t vlmax = vext_get_vlmax(cpu, env->vtype);
          uint32_t sew = FIELD_EX64(env->vtype, VTYPE, VSEW);
          uint32_t maxsz = vlmax << sew;
          bool vl_eq_vlmax = (env->vstart == 0) && (vlmax == env->vl) &&
maintainer Applied
#3 lore raw
In reply to Daniel Henrique Barboza
Quoted 12 lines · On Fri, 10 Feb 2023 04:38:36 PST (-0800), [email protected] wrote:

We have a RISCVCPU *cpu pointer available at the start of the function.

---
 target/riscv/cpu_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu_helper.c +0 -0
index ad8d82662c..3a9472a2ff 100644

target/riscv/cpu_helper.c void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, · line 66

Quoted 8 lines
target/riscv/cpu_helper.c +1 -1
@@ -60,7 +60,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
          * which is not supported by GVEC. So we set vl_eq_vlmax flag to true
          * only when maxsz >= 8 bytes.
          */
-        uint32_t vlmax = vext_get_vlmax(env_archcpu(env), env->vtype);
+        uint32_t vlmax = vext_get_vlmax(cpu, env->vtype);
         uint32_t sew = FIELD_EX64(env->vtype, VTYPE, VSEW);
         uint32_t maxsz = vlmax << sew;
         bool vl_eq_vlmax = (env->vstart == 0) && (vlmax == env->vl) &&

Thanks, applied to riscv-to-apply.next