From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
"Alistair Francis" <alistair.francis@xilinx.com>,
"sridhar kulkarni" <sridhar_kulk@yahoo.com>,
qemu-arm <qemu-arm@nongnu.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Piotr Król" <piotr.krol@3mdeb.com>
Subject: Re: [Qemu-devel] [PATCH v1 04/17] target-arm: implement SCTLR.EE
Date: Sat, 27 Feb 2016 13:56:20 -0800 [thread overview]
Message-ID: <CAPokK=q+gcoQx_2N_Ry0rQAfDdapytVMOndqHzqEO0yaLdyHTg@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA_-X0SMfihg288z7w-pQhAUJH-BS+N3PooPNQAT5dcH6Q@mail.gmail.com>
On Tue, Jan 19, 2016 at 7:58 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 18 January 2016 at 07:12, Peter Crosthwaite
> <crosthwaitepeter@gmail.com> wrote:
>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>
>> Implement SCTLR.EE bit which controls data endianess for exceptions
>> and page table translations. SCTLR.EE is mirrored to the CPSR.E bit
>> on exception entry.
>>
>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>> ---
>>
>> target-arm/helper.c | 42 ++++++++++++++++++++++++++++++++----------
>> 1 file changed, 32 insertions(+), 10 deletions(-)
>>
>> diff --git a/target-arm/helper.c b/target-arm/helper.c
>> index 59d5a41..afac1b2 100644
>> --- a/target-arm/helper.c
>> +++ b/target-arm/helper.c
>> @@ -5889,7 +5889,10 @@ void arm_cpu_do_interrupt(CPUState *cs)
>> /* Clear IT bits. */
>> env->condexec_bits = 0;
>> /* Switch to the new mode, and to the correct instruction set. */
>> - env->uncached_cpsr = (env->uncached_cpsr & ~CPSR_M) | new_mode;
>> + env->uncached_cpsr = (env->uncached_cpsr & ~(CPSR_M)) | new_mode;
>
> Why change this line?
>
Reverted
>> + /* Set new mode endianess */
>
> "endianness"
>
Fixed
>> + env->uncached_cpsr = (env->uncached_cpsr & ~(CPSR_E)) |
>> + (env->cp15.sctlr_el[arm_current_el(env)] & SCTLR_EE ? CPSR_E : 0);
>
> This is a bit confusing. I think just splitting it into
> multiple statements would help:
> env->uncached_cpsr &= ~CPSR_E;
> if (env->cp15.sctlr_el[arm_current_el(env)] & SCTLR_EE) {
> env->uncached_cpsr |= CPSR_E;
> }
>
Fixed.
>> env->daif |= mask;
>> /* this is a lie, as the was no c1_sys on V4T/V5, but who cares
>> * and we should just guard the thumb mode on V4 */
>> @@ -5958,6 +5961,12 @@ static inline bool regime_translation_disabled(CPUARMState *env,
>> return (regime_sctlr(env, mmu_idx) & SCTLR_M) == 0;
>> }
>>
>> +static inline bool regime_translation_big_endian(CPUARMState *env,
>> + ARMMMUIdx mmu_idx)
>> +{
>> + return (regime_sctlr(env, mmu_idx) & SCTLR_EE) != 0;
>> +}
>> +
>> /* Return the TCR controlling this translation regime */
>> static inline TCR *regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx)
>> {
>> @@ -6263,7 +6272,7 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
>> */
>> static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure,
>> ARMMMUIdx mmu_idx, uint32_t *fsr,
>> - ARMMMUFaultInfo *fi)
>> + ARMMMUFaultInfo *fi, bool be)
>> {
>> ARMCPU *cpu = ARM_CPU(cs);
>> CPUARMState *env = &cpu->env;
>> @@ -6274,12 +6283,16 @@ static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure,
>> if (fi->s1ptw) {
>> return 0;
>> }
>> - return address_space_ldl(cs->as, addr, attrs, NULL);
>> + if (be) {
>> + return address_space_ldl_be(cs->as, addr, attrs, NULL);
>> + } else {
>> + return address_space_ldl_le(cs->as, addr, attrs, NULL);
>> + }
>> }
>
> Why not just call regime_translation_big_endian() inside arm_ldl_ptw()
> and arm_ldq_ptw(), rather than having every call site making the call
> and passing in the result?
>
Fixed.
> PS: this patch will conflict with the multi-ases series but only
> fairly trivially.
>
Resolved.
Regards,
Peter
> thanks
> -- PMM
next prev parent reply other threads:[~2016-02-27 21:56 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 7:12 [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support Peter Crosthwaite
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 01/17] linux-user: arm: fix coding style for some linux-user signal functions Peter Crosthwaite
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 02/17] linux-user: arm: set CPSR.E/SCTLR.E0E correctly for BE mode Peter Crosthwaite
2016-01-19 16:22 ` Peter Maydell
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 03/17] linux-user: arm: handle CPSR.E correctly in strex emulation Peter Crosthwaite
2016-01-19 16:24 ` Peter Maydell
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 04/17] target-arm: implement SCTLR.EE Peter Crosthwaite
2016-01-19 15:58 ` Peter Maydell
2016-02-27 21:56 ` Peter Crosthwaite [this message]
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 05/17] target-arm: pass DisasContext to gen_aa32_ld*/st* Peter Crosthwaite
2016-01-19 16:08 ` Peter Maydell
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 06/17] target-arm: introduce disas flag for endianness Peter Crosthwaite
2016-01-19 16:08 ` Peter Maydell
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 07/17] target-arm: a64: Add endianness support Peter Crosthwaite
2016-01-19 16:09 ` Peter Maydell
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 08/17] target-arm: cpu: Move cpu_is_big_endian to header Peter Crosthwaite
2016-01-18 21:52 ` Alistair Francis
2016-01-19 16:11 ` Peter Maydell
2016-02-27 22:02 ` Peter Crosthwaite
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 09/17] target-arm: introduce tbflag for endianness Peter Crosthwaite
2016-01-19 16:15 ` Peter Maydell
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 10/17] target-arm: implement setend Peter Crosthwaite
2016-01-19 16:29 ` Peter Maydell
2016-02-27 22:14 ` Peter Crosthwaite
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 11/17] linux-user: arm: pass env to get_user_code_* Peter Crosthwaite
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 12/17] target-arm: implement SCTLR.B, drop bswap_code Peter Crosthwaite
2016-01-19 17:21 ` Peter Maydell
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 13/17] arm: linux-user: don't set CPSR.E in BE32 mode Peter Crosthwaite
2016-01-19 17:26 ` Peter Maydell
2016-01-19 17:35 ` Peter Maydell
2016-02-27 22:22 ` Peter Crosthwaite
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 14/17] target-arm: implement BE32 mode in system emulation Peter Crosthwaite
2016-01-19 17:39 ` Peter Maydell
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 15/17] loader: add API to load elf header Peter Crosthwaite
2016-01-19 17:50 ` Peter Maydell
2016-02-27 22:46 ` Peter Crosthwaite
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 16/17] loader: Add data swap option to load-elf Peter Crosthwaite
2016-01-19 17:53 ` Peter Maydell
2016-02-27 23:14 ` Peter Crosthwaite
2016-02-28 15:28 ` Peter Maydell
2016-02-28 20:16 ` Peter Crosthwaite
2016-01-18 7:12 ` [Qemu-devel] [PATCH v1 17/17] arm: boot: Support big-endian elfs Peter Crosthwaite
2016-01-19 18:06 ` Peter Maydell
2016-02-27 23:59 ` Peter Crosthwaite
2016-01-19 18:06 ` [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support Peter Maydell
2016-03-01 5:27 ` Stefan Weil
2016-03-01 18:26 ` Peter Crosthwaite
2016-03-01 18:43 ` Peter Crosthwaite
2016-03-01 21:03 ` Paolo Bonzini
2016-03-01 21:34 ` Andrew Baumann
2016-03-02 5:31 ` Peter Crosthwaite
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPokK=q+gcoQx_2N_Ry0rQAfDdapytVMOndqHzqEO0yaLdyHTg@mail.gmail.com' \
--to=crosthwaitepeter@gmail.com \
--cc=alistair.francis@xilinx.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=piotr.krol@3mdeb.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sridhar_kulk@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).