Skip to contentSkip to conversation

target/riscv: Align the data type of reset vector address

PATCH Applied Dylan Jhong 2 participants 2 messages Mar 29, 2021 – Mar 30, 2021 RISC-V

v4 of 5 Applied Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 target/riscv: Align the data type of reset vector address

Use target_ulong to instead of uint64_t on reset vector address to adapt on both 32/64 machine.

---
 target/riscv/cpu.c | 5 +++--
 target/riscv/cpu.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
target/riscv/cpu.c +3 -2
index 7d6ed80f6b..268945d8a9 100644
@@ -137,7 +137,7 @@ static void set_feature(CPURISCVState *env, int feature)
     env->features |= (1ULL << feature);
 }
 
-static void set_resetvec(CPURISCVState *env, int resetvec)
+static void set_resetvec(CPURISCVState *env, target_ulong resetvec)
 {
 #ifndef CONFIG_USER_ONLY
     env->resetvec = resetvec;
@@ -554,7 +554,8 @@ static Property riscv_cpu_properties[] = {
     DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64),
     DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true),
     DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true),
-    DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC),
+    DEFINE_PROP_UNSIGNED("resetvec", RISCVCPU, cfg.resetvec,
+        DEFAULT_RSTVEC, qdev_prop_uint64, target_ulong),
     DEFINE_PROP_END_OF_LIST(),
 };
 
target/riscv/cpu.h +1 -1
index 0a33d387ba..d9d7891666 100644
@@ -303,7 +303,7 @@ struct RISCVCPU {
         uint16_t elen;
         bool mmu;
         bool pmp;
-        uint64_t resetvec;
+        target_ulong resetvec;
     } cfg;
 };
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Dylan Jhong

Use target_ulong to instead of uint64_t on reset vector address to adapt on both 32/64 machine.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 45 lines
---
 target/riscv/cpu.c | 5 +++--
 target/riscv/cpu.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
target/riscv/cpu.c +3 -2
index 7d6ed80f6b..268945d8a9 100644
@@ -137,7 +137,7 @@ static void set_feature(CPURISCVState *env, int feature)
     env->features |= (1ULL << feature);
 }
 
-static void set_resetvec(CPURISCVState *env, int resetvec)
+static void set_resetvec(CPURISCVState *env, target_ulong resetvec)
 {
 #ifndef CONFIG_USER_ONLY
     env->resetvec = resetvec;
@@ -554,7 +554,8 @@ static Property riscv_cpu_properties[] = {
     DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64),
     DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true),
     DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true),
-    DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC),
+    DEFINE_PROP_UNSIGNED("resetvec", RISCVCPU, cfg.resetvec,
+        DEFAULT_RSTVEC, qdev_prop_uint64, target_ulong),
     DEFINE_PROP_END_OF_LIST(),
 };
 
target/riscv/cpu.h +1 -2
index 0a33d387ba..d9d7891666 100644
@@ -303,7 +303,7 @@ struct RISCVCPU {
         uint16_t elen;
         bool mmu;
         bool pmp;
-        uint64_t resetvec;
+        target_ulong resetvec;
     } cfg;
 };
 
--

2.17.1