diff options
author | Peter Crosthwaite | 2016-03-04 12:30:19 +0100 |
---|---|---|
committer | Peter Maydell | 2016-03-04 12:30:19 +0100 |
commit | ed50ff7875d61a75517c92deb0444d73fbbca878 (patch) | |
tree | 3ca6e116bd31d3fea04fe7df2fd0945f5e6e35db /target-arm/cpu.h | |
parent | target-arm: implement SCTLR.B, drop bswap_code (diff) | |
download | qemu-ed50ff7875d61a75517c92deb0444d73fbbca878.tar.gz qemu-ed50ff7875d61a75517c92deb0444d73fbbca878.tar.xz qemu-ed50ff7875d61a75517c92deb0444d73fbbca878.zip |
target-arm: cpu: Move cpu_is_big_endian to header
There is a CPU data endianness test that is used to drive the
virtio_big_endian test.
Move this up to the header so it can be more generally used for endian
tests. The KVM specific cpu_syncronize_state call is left behind in the
virtio specific function.
Rename it arm_cpu-data_is_big_endian() to more accurately capture that
this is for data accesses only.
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm/cpu.h')
-rw-r--r-- | target-arm/cpu.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 61b8b03f65..75e5ea0a43 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -1908,6 +1908,25 @@ static inline bool arm_sctlr_b(CPUARMState *env) (env->cp15.sctlr_el[1] & SCTLR_B) != 0; } +/* 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 (env->uncached_cpsr & CPSR_E) ? 1 : 0; + } + + 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" /* Bit usage in the TB flags field: bit 31 indicates whether we are |