From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v3 03/11] target-arm: implement SCTLR.B, drop bswap_code
Date: Thu, 26 Jun 2014 16:15:36 +0200 [thread overview]
Message-ID: <53AC2B08.8030404@redhat.com> (raw)
In-Reply-To: <CAFEAcA8oZnQRDQ1WS-o-2ZK3Kyr8XMm0fCgQqpJwkWiiOU3k2g@mail.gmail.com>
Il 26/06/2014 16:01, Peter Maydell ha scritto:
> On 21 June 2014 13:58, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> bswap_code is a CPU property of sorts ("is the iside endianness the
>> opposite way round to TARGET_WORDS_BIGENDIAN?") but it is not the
>> actual CPU state involved here which is SCTLR.B (set for BE32
>> binaries, clear for BE8).
>>
>> Replace bswap_code with SCTLR.B, and pass that to arm_ld*_code.
>> The next patches will make data fetches honor both SCTLR.B and
>> CPSR.E appropriately.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
>> @@ -4191,11 +4191,19 @@ int main(int argc, char **argv, char **envp)
>> for(i = 0; i < 16; i++) {
>> env->regs[i] = regs->uregs[i];
>> }
>> +#ifdef TARGET_WORDS_BIGENDIAN
>> /* Enable BE8. */
>> if (EF_ARM_EABI_VERSION(info->elf_flags) >= EF_ARM_EABI_VER4
>> && (info->elf_flags & EF_ARM_BE8)) {
>> - env->bswap_code = 1;
>> + /* nothing for now, CPSR.E not emulated yet */
>> + } else {
>> + if (arm_feature(env, ARM_FEATURE_V7)) {
>> + fprintf(stderr, "BE32 binaries only supported until ARMv6\n");
>> + exit(1);
>> + }
>> + env->cp15.c1_sys |= SCTLR_B;
>
> This will break running BE32 binaries with "-cpu any"
> (which sets all the features we know about, including
> ARM_FEATURE_V7).
Yes, this was on purpose.
>> +static inline bool bswap_code(bool sctlr_b)
>> +{
>> +#ifdef CONFIG_USER_ONLY
>> + /* Mixed-endian modes are BE8 (SCTLR.B = 0, TARGET_WORDS_BIGENDIAN = 1)
>> + * and "LE8" (SCTLR.B = 1, TARGET_WORDS_BIGENDIAN = 0).
>
> Huh? LE8 is SCTLR.B == 0...
I think LE8 is an R core with SCTLR.IE=1 SCTLR.EE=1 but CPSR.E=0, i.e.
little endian data and big-endian code. I put it in quotes because I
get this with SCTLR.B=1 CPSR.E=1. The difference is user visible due
to CPSR.E.
I can modify the comment to:
/* BE8 (SCTLR.B = 0, TARGET_WORDS_BIGENDIAN = 1) is mixed endian.
* The invalid combination SCTLR.B=1/CPSR.E=1/TARGET_WORDS_BIGENDIAN=0
* would also end up as a mixed-endian mode with BE code, LE data.
*/
>> @@ -11142,7 +11142,7 @@ done_generating:
>> qemu_log("----------------\n");
>> qemu_log("IN: %s\n", lookup_symbol(pc_start));
>> log_target_disas(env, pc_start, dc->pc - pc_start,
>> - dc->thumb | (dc->bswap_code << 1));
>> + dc->thumb | (dc->sctlr_b << 1));
>
> Don't we need a call to bswap_code() here, since we're
> telling the disassembler which endianness to assume?
Yes, I misread the code in disas.c.
Paolo
next prev parent reply other threads:[~2014-06-26 14:16 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-21 12:58 [Qemu-devel] [PATCH v3 00/11] implement dynamic endianness switching Paolo Bonzini
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 01/11] linux-user: arm: fix coding style for some linux-user signal functions Paolo Bonzini
2014-06-26 14:22 ` Peter Maydell
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 02/11] linux-user: arm: pass env to get_user_code_* Paolo Bonzini
2014-06-26 14:23 ` Peter Maydell
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 03/11] target-arm: implement SCTLR.B, drop bswap_code Paolo Bonzini
2014-06-26 14:01 ` Peter Maydell
2014-06-26 14:15 ` Paolo Bonzini [this message]
2014-06-26 14:53 ` Peter Maydell
2014-06-26 16:14 ` Paolo Bonzini
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 04/11] linux-user: arm: set CPSR.E correctly for BE8 mode Paolo Bonzini
2014-06-26 14:15 ` Peter Maydell
2014-06-26 14:18 ` Paolo Bonzini
2015-06-22 22:48 ` Peter Crosthwaite
2015-06-23 8:04 ` Peter Maydell
2015-06-23 18:43 ` Peter Crosthwaite
2015-06-23 18:54 ` Peter Maydell
2015-06-23 20:30 ` Peter Crosthwaite
2015-06-23 21:34 ` Peter Maydell
2015-06-24 10:09 ` Paolo Bonzini
2015-06-24 10:21 ` Peter Maydell
2015-06-24 10:34 ` Paolo Bonzini
2015-06-24 10:48 ` Peter Maydell
2015-06-24 10:49 ` Paolo Bonzini
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 05/11] linux-user: arm: handle CPSR.E correctly in strex emulation Paolo Bonzini
2014-06-26 14:21 ` Peter Maydell
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 06/11] target-arm: implement SCTLR.EE Paolo Bonzini
2014-06-26 14:29 ` Peter Maydell
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 07/11] target-arm: pass DisasContext to gen_aa32_ld*/st* Paolo Bonzini
2014-06-26 14:31 ` Peter Maydell
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 08/11] target-arm: introduce tbflag for CPSR.E Paolo Bonzini
2014-06-26 14:33 ` Peter Maydell
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 09/11] target-arm: implement setend Paolo Bonzini
2014-06-26 14:35 ` Peter Maydell
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 10/11] target-arm: reorganize gen_aa32_ld/st to prepare for BE32 system emulation Paolo Bonzini
2014-06-26 14:38 ` Peter Maydell
2014-06-21 12:58 ` [Qemu-devel] [PATCH v3 11/11] target-arm: implement BE32 mode in " Paolo Bonzini
2014-06-21 20:16 ` Richard Henderson
2014-06-26 14:43 ` Peter Maydell
2014-06-26 14:51 ` Paolo Bonzini
2014-12-28 12:12 ` [Qemu-devel] [PATCH v3 00/11] implement dynamic endianness switching Stefan Weil
2014-12-28 21:26 ` Paolo Bonzini
2015-06-18 18:37 ` Peter Crosthwaite
2015-06-18 19:00 ` Paolo Bonzini
2015-06-18 20:24 ` Peter Crosthwaite
2015-06-19 7:07 ` Paolo Bonzini
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=53AC2B08.8030404@redhat.com \
--to=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.