[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 05/11] linux-user: arm: handle CPSR.E correct
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v3 05/11] linux-user: arm: handle CPSR.E correctly in strex emulation |
Date: |
Thu, 26 Jun 2014 15:21:49 +0100 |
On 21 June 2014 13:58, Paolo Bonzini <address@hidden> wrote:
> Now that CPSR.E is set correctly, prepare for when setend will be able
> to change it; bswap data in and out of strex manually by comparing
> SCTLR.B, CPSR.E and TARGET_WORDS_BIGENDIAN (we do not have the luxury
> of using TCGMemOps).
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -1192,6 +1192,34 @@ static inline bool bswap_code(bool sctlr_b)
> #endif
> }
>
> +#ifdef CONFIG_USER_ONLY
> +/* get_user and put_user respectivaly return and expect data according
"respectively"
> + * to TARGET_WORDS_BIGENDIAN, but ldrex/strex emulation needs to take
> + * into account CPSR.E. Similar to bwap_code, a XOR gives exactly the
"bswap_code"
> + * required result, we just throw CPSR.E into the mix too:
> + *
> + * TARGET_WORDS_BIGENDIAN SCTLR.B CPSR.E need swap?
> + * LE/LE no 0 0 no
> + * LE/BE no 0 1 yes
> + * BE8/LE yes 0 0 yes
> + * BE8/BE yes 0 1 no
> + * BE32/BE yes 1 0 no
> + * (BE32/LE) yes 1 1 yes
> + *
> + * Officially, BE32 with CPSR.E=1 has "unpredictable" results. We
> + * implement it as big-endian code, little-endian data.
> + */
> +static inline bool arm_cpu_bswap_data(CPUARMState *env)
> +{
> + return
> +#ifdef TARGET_WORDS_BIGENDIAN
> + 1 ^
> +#endif
> + arm_sctlr_b(env) ^
> + !!(env->uncached_cpsr & CPSR_E);
> +}
> +#endif
Otherwise
Reviewed-by: Peter Maydell <address@hidden>
-- PMM
- [Qemu-devel] [PATCH v3 03/11] target-arm: implement SCTLR.B, drop bswap_code, (continued)
- [Qemu-devel] [PATCH v3 04/11] linux-user: arm: set CPSR.E correctly for BE8 mode, Paolo Bonzini, 2014/06/21
- [Qemu-devel] [PATCH v3 06/11] target-arm: implement SCTLR.EE, Paolo Bonzini, 2014/06/21
- [Qemu-devel] [PATCH v3 05/11] linux-user: arm: handle CPSR.E correctly in strex emulation, Paolo Bonzini, 2014/06/21
- Re: [Qemu-devel] [PATCH v3 05/11] linux-user: arm: handle CPSR.E correctly in strex emulation,
Peter Maydell <=
- [Qemu-devel] [PATCH v3 07/11] target-arm: pass DisasContext to gen_aa32_ld*/st*, Paolo Bonzini, 2014/06/21
- [Qemu-devel] [PATCH v3 08/11] target-arm: introduce tbflag for CPSR.E, Paolo Bonzini, 2014/06/21
- [Qemu-devel] [PATCH v3 09/11] target-arm: implement setend, Paolo Bonzini, 2014/06/21
- [Qemu-devel] [PATCH v3 10/11] target-arm: reorganize gen_aa32_ld/st to prepare for BE32 system emulation, Paolo Bonzini, 2014/06/21
- [Qemu-devel] [PATCH v3 11/11] target-arm: implement BE32 mode in system emulation, Paolo Bonzini, 2014/06/21