All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v3 04/11] linux-user: arm: set CPSR.E correctly for BE8 mode
Date: Tue, 23 Jun 2015 19:54:43 +0100	[thread overview]
Message-ID: <CAFEAcA8P_7Vb_6kaqJ1HpENthruxG1UA71a7VL7tAUgcOspccQ@mail.gmail.com> (raw)
In-Reply-To: <CAEgOgz5cMWCkOzKCVViNaPjbH6gOtHS-W8J4OPxoNwRKpgyUrw@mail.gmail.com>

On 23 June 2015 at 19:43, Peter Crosthwaite
<peter.crosthwaite@xilinx.com> wrote:
> On Tue, Jun 23, 2015 at 1:04 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> The Linux userland ABI says:
>>  (1) the ELF file defines whether an executable is BE8 or not
>>  (2) this setting affects:
>>     (a) whether we start at the process entry point in BE or LE
>>     (b) whether we run signal handlers in BE or LE
>>     (c) whether newly cloned threads start in BE or LE
>>
>> signal_cpsr_e is how this patch implements that -- we set it
>> based on the ELF file flags, then set CPSR.E based on it:
>>  * in main, for the initial thread
>>  * in cpu_clone_regs, for subsequent threads

Aside: this is a bug in the patch which I noted first time
round with code review -- new threads don't get CPSR.E reset
like this, they inherit the CPSR.E of the thread they're
cloned from.

>>  * in signal.c, for signal handlers

This is what the flag is really for.

>> For AArch64 BE we will need something similar. I don't know if
>> there's somewhere more appropriate to store this "what's the
>> ELF file endianness" state, but we do need to keep it somewhere...
>>
>
> So my current thinking is the new state captured in TB flags,
> disas-context and this thing is just a bool for endianess. No sense of
> CPSR.E or SCTLR.xx in the newly added state across the series. The TB
> flag is then based on SCTLR.EE, SCTLR.E0E or CPSR.E depending on
> processor mode. We already have arm_cpu_is_big_endian() to calculate
> this.

I'm confused. arm_cpu_is_big_endian() tells you whether the CPU
is *currently* big-endian or not. That doesn't help you with
answering the question "I'm about to run a signal handler; what
should I set the CPSR.E bit to?" in linux-user mode. That's
what signal_cpsr_e does.

> That means that this logic would change signal_cpsr_e to a generic
> endianess bool that will set both SCTLR_EL1.E0E and CPSR.E at all the
> points Paolo is patching. SCTLR.EEs shouldn't need patching as
> usermode shouldn't be affected (maybe add an assert in
> arm_cpu_big_endian for usermode).

I'm not entirely sure what you're suggesting here, but
a "generic endianness bool" sounds more confusing than something
that's specific about exactly what it's trying to control.
"endianness for data accesses", "endianness for code accesses",
"BE8 vs BE32", "setting of TARGET_WORDS_BIGENDIAN", "endianness
to use for signal handlers", "exception endianness" and so on
are all different concepts which can't necessarily be collapsed
into a single "endianness bool".

thanks
-- PMM

  reply	other threads:[~2015-06-23 18:55 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
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 [this message]
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=CAFEAcA8P_7Vb_6kaqJ1HpENthruxG1UA71a7VL7tAUgcOspccQ@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --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.