qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH v2 4/9] target/riscv: Remove the hardcoded MSTATUS_SD macro


From: Richard Henderson
Subject: Re: [PATCH v2 4/9] target/riscv: Remove the hardcoded MSTATUS_SD macro
Date: Tue, 13 Apr 2021 20:13:36 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 4/13/21 4:33 PM, Alistair Francis wrote:
+#ifndef CONFIG_USER_ONLY
+# ifdef TARGET_RISCV32
+#  define is_32bit(ctx)  true
+# else
+static inline bool is_32bit(DisasContext *ctx)
+{
+    return !(ctx->misa & RV64);
+}
+# endif
+#endif

It's going to be soon enough when this is used by user-only too.
I'd structure this as

#ifdef TARGET_RISCV32
# define is_32bit(ctx)  true
#elif defined(CONFIG_USER_ONLY)
# define is_32bit(ctx)  false
#else
static inline...
#endif

      tmp = tcg_temp_new();
+    sd = is_32bit(ctx) ? MSTATUS32_SD : MSTATUS64_SD;
+
+
      tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus));

Careful with the extra whitespace.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



reply via email to

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