qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/riscv: Use TARGET_FMT_lx for env->mhartid


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] target/riscv: Use TARGET_FMT_lx for env->mhartid
Date: Mon, 9 Jan 2023 16:47:31 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

On 9/1/23 16:26, Bin Meng wrote:
env->mhartid is currently casted to long before printed, which drops
the high 32-bit for rv64 on 32-bit host. Use TARGET_FMT_lx instead.

Oh, a 32-bit host user!

Signed-off-by: Bin Meng <bmeng@tinylab.org>
---

  target/riscv/cpu.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index cc75ca7667..a5ed6d3f63 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -660,9 +660,9 @@ static void riscv_cpu_realize(DeviceState *dev, Error 
**errp)
              (env->priv_ver < isa_edata_arr[i].min_version)) {
              isa_ext_update_enabled(cpu, &isa_edata_arr[i], false);
  #ifndef CONFIG_USER_ONLY
-            warn_report("disabling %s extension for hart 0x%lx because "
-                        "privilege spec version does not match",
-                        isa_edata_arr[i].name, (unsigned long)env->mhartid);
+            warn_report("disabling %s extension for hart 0x" TARGET_FMT_lx
+                        " because privilege spec version does not match",
+                        isa_edata_arr[i].name, env->mhartid);

Could we cast it to vaddr instead? I'm trying to remove target_[u]long
from hw/ and restrict it to the target/ directory. Per "exec/cpu-common.h":

 /**
  * vaddr:
  * Type wide enough to contain any #target_ulong virtual address.
  */
 typedef uint64_t vaddr;

Alternatively, since this value has to be accessed out of target/,
can we change its type to vaddr in CPURISCVState?

Thanks,

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]