@samitouri / QOSamiQemu / commits / b9b75ac607

target/riscv: Expose mo_endian_env()

Move mo_endian_env() definition to "internals.h" for re-use. Do not restrict to system emulation only because this will also be used by user emulation code. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20260318103122.97244-10-philmd@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Philippe Mathieu-Daudé committed Mar 18, 2026 at 11:31 UTC b9b75ac60742d9d5850550f18be1ee658249bef4
2 files changed +12 -14
target/riscv/internals.h
+12
@@ -62,6 +62,18 @@ static inline bool mmuidx_2stage(int mmu_idx)
62 return mmu_idx & MMU_2STAGE_BIT;
63 }
64
65 +static inline MemOp mo_endian_env(CPURISCVState *env)
66 +{
67 + /*
68 + * A couple of bits in MSTATUS set the endianness:
69 + * - MSTATUS_UBE (User-mode),
70 + * - MSTATUS_SBE (Supervisor-mode),
71 + * - MSTATUS_MBE (Machine-mode)
72 + * but we don't implement that yet.
73 + */
74 + return MO_TE;
75 +}
76 +
77 /* share data between vector helpers and decode code */
78 FIELD(VDATA, VM, 0, 1)
79 FIELD(VDATA, LMUL, 1, 3)
target/riscv/op_helper.c
-14
@@ -28,20 +28,6 @@
28 #include "exec/tlb-flags.h"
29 #include "trace.h"
30
31 -#ifndef CONFIG_USER_ONLY
32 -static inline MemOp mo_endian_env(CPURISCVState *env)
33 -{
34 - /*
35 - * A couple of bits in MSTATUS set the endianness:
36 - * - MSTATUS_UBE (User-mode),
37 - * - MSTATUS_SBE (Supervisor-mode),
38 - * - MSTATUS_MBE (Machine-mode)
39 - * but we don't implement that yet.
40 - */
41 - return MO_TE;
42 -}
43 -#endif
44 -
31 /* Exceptions processing helpers */
32 G_NORETURN void riscv_raise_exception(CPURISCVState *env,
33 RISCVException exception,