[PATCH v5 10/11] target/ppc: Check endianness at runtime in mo_endian_env()

Philippe Mathieu-Daudé posted 11 patches 2 weeks, 3 days ago
Maintainers: Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>
There is a newer version of this series
[PATCH v5 10/11] target/ppc: Check endianness at runtime in mo_endian_env()
Posted by Philippe Mathieu-Daudé 2 weeks, 3 days ago
Rather a runtime endianness check via env MSR over
a build-time one.

Now CPU can change endianness at runtime.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/ppc/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/ppc/internal.h b/target/ppc/internal.h
index 714629079b5..7dfca0b41a3 100644
--- a/target/ppc/internal.h
+++ b/target/ppc/internal.h
@@ -31,7 +31,7 @@ static inline bool ppc_env_is_little_endian(const CPUPPCState *env)
 
 static inline MemOp mo_endian_env(const CPUPPCState *env)
 {
-    return MO_TE;
+    return ppc_env_is_little_endian(env) ? MO_LE : MO_BE;
 }
 
 /* PM instructions */
-- 
2.52.0


Re: [PATCH v5 10/11] target/ppc: Check endianness at runtime in mo_endian_env()
Posted by Anton Johansson via qemu development 1 week ago
On 22/01/26, Philippe Mathieu-Daudé wrote:
> Rather a runtime endianness check via env MSR over
> a build-time one.
> 
> Now CPU can change endianness at runtime.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  target/ppc/internal.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Anton Johansson <anjo@rev.ng>