qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]