[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/20] target/arm: Fix arm_cpu_data_is_big_endian fo
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 05/20] target/arm: Fix arm_cpu_data_is_big_endian for aa64 user-only |
Date: |
Wed, 8 Aug 2018 21:21:51 -0700 |
Unlike aa32, endianness cannot be adjusted by userland in aa64.
Signed-off-by: Richard Henderson <address@hidden>
---
target/arm/cpu.h | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 9526ed27cb..2d6d7d03aa 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -2709,8 +2709,6 @@ static inline bool arm_sctlr_b(CPUARMState *env)
/* Return true if the processor is in big-endian mode. */
static inline bool arm_cpu_data_is_big_endian(CPUARMState *env)
{
- int cur_el;
-
/* In 32bit endianness is determined by looking at CPSR's E bit */
if (!is_a64(env)) {
return
@@ -2729,15 +2727,24 @@ static inline bool
arm_cpu_data_is_big_endian(CPUARMState *env)
arm_sctlr_b(env) ||
#endif
((env->uncached_cpsr & CPSR_E) ? 1 : 0);
+ } else {
+#ifdef CONFIG_USER_ONLY
+ /* AArch64 does not have a SETEND instruction; endianness
+ * for usermode is fixed at compile-time.
+ */
+# ifdef TARGET_WORDS_BIGENDIAN
+ return true;
+# else
+ return false;
+# endif
+#else
+ int cur_el = arm_current_el(env);
+ if (cur_el == 0) {
+ return (env->cp15.sctlr_el[1] & SCTLR_E0E) != 0;
+ }
+ return (env->cp15.sctlr_el[cur_el] & SCTLR_EE) != 0;
+#endif
}
-
- cur_el = arm_current_el(env);
-
- if (cur_el == 0) {
- return (env->cp15.sctlr_el[1] & SCTLR_E0E) != 0;
- }
-
- return (env->cp15.sctlr_el[cur_el] & SCTLR_EE) != 0;
}
#include "exec/cpu-all.h"
--
2.17.1
- [Qemu-devel] [PATCH 00/20] target/arm: sve system mode patches, Richard Henderson, 2018/08/09
- [Qemu-devel] [PATCH 01/20] target/arm: Set ISAR bits for -cpu max, Richard Henderson, 2018/08/09
- [Qemu-devel] [PATCH 03/20] target/arm: Define ID_AA64ZFR0_EL1, Richard Henderson, 2018/08/09
- [Qemu-devel] [PATCH 02/20] target/arm: Set ID_AA64PFR0 bits for SVE for -cpu max, Richard Henderson, 2018/08/09
- [Qemu-devel] [PATCH 04/20] target/arm: Adjust sve_exception_el, Richard Henderson, 2018/08/09
- [Qemu-devel] [PATCH 05/20] target/arm: Fix arm_cpu_data_is_big_endian for aa64 user-only,
Richard Henderson <=
- [Qemu-devel] [PATCH 06/20] target/arm: Fix arm_current_el for user-only, Richard Henderson, 2018/08/09
- [Qemu-devel] [PATCH 08/20] target/arm: Pass in current_el to fp and sve_exception_el, Richard Henderson, 2018/08/09
- [Qemu-devel] [PATCH 07/20] target/arm: Fix is_a64 for user-only, Richard Henderson, 2018/08/09