From: Peter Maydell <peter.maydell@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: 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: Thu, 26 Jun 2014 15:15:00 +0100 [thread overview]
Message-ID: <CAFEAcA_TiDJKduwitTsKXSp1VWZJ0SjEnJrqqPUM2L2cDBmT+A@mail.gmail.com> (raw)
In-Reply-To: <1403355502-12288-5-git-send-email-pbonzini@redhat.com>
On 21 June 2014 13:58, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Set it on startup, in signal handler frames and in new threads.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> linux-user/arm/target_cpu.h | 2 ++
> linux-user/main.c | 3 ++-
> linux-user/signal.c | 2 ++
> target-arm/cpu.h | 3 +++
> 4 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/linux-user/arm/target_cpu.h b/linux-user/arm/target_cpu.h
> index 39d65b6..d0411c7 100644
> --- a/linux-user/arm/target_cpu.h
> +++ b/linux-user/arm/target_cpu.h
> @@ -25,6 +25,8 @@ static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp)
> env->regs[13] = newsp;
> }
> env->regs[0] = 0;
> + env->uncached_cpsr &= ~CPSR_E;
> + env->uncached_cpsr |= env->signal_cpsr_e;
Where does this come from? I can't see anything in the
kernel's handling of clone that changes CPSR.E...
http://lxr.free-electrons.com/source/arch/arm/kernel/process.c#L346
(There is code for handling CPSR_E in the kernel's start_thread()
macro but that is actually only called for starting new
processes, AFAICT.)
> }
>
> static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls)
> diff --git a/linux-user/main.c b/linux-user/main.c
> index dbaa42a..795a407 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -4195,7 +4195,8 @@ int main(int argc, char **argv, char **envp)
> /* Enable BE8. */
> if (EF_ARM_EABI_VERSION(info->elf_flags) >= EF_ARM_EABI_VER4
> && (info->elf_flags & EF_ARM_BE8)) {
> - /* nothing for now, CPSR.E not emulated yet */
> + env->uncached_cpsr |= CPSR_E;
> + env->signal_cpsr_e = CPSR_E;
> } else {
> if (arm_feature(env, ARM_FEATURE_V7)) {
> fprintf(stderr, "BE32 binaries only supported until ARMv6\n");
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 624c34d..87ddabd 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -1609,6 +1609,8 @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
> cpsr &= ~CPSR_T;
> }
>
> + cpsr |= env->signal_cpsr_e;
This won't clear CPSR.E if it happened to be set;
you should probably make the earlier 'cpsr &= ~CPSR_IT;'
be 'cpsr &= ~(CPSR_IT | CPSR_E);'
> +
> if (ka->sa_flags & TARGET_SA_RESTORER) {
> retcode = ka->sa_restorer;
> } else {
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index 4a9d2a8..cb5be84 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -316,6 +316,9 @@ typedef struct CPUARMState {
> #if defined(CONFIG_USER_ONLY)
> /* For usermode syscall translation. */
> int eabi;
> +
> + /* CPSR.E value for new threads and signal handlers. */
I think "new threads and" should be deleted here, see above.
> + uint32_t signal_cpsr_e;
> #endif
>
> CPU_COMMON
> --
> 1.9.3
thanks
-- PMM
next prev parent reply other threads:[~2014-06-26 14:15 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 [this message]
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=CAFEAcA_TiDJKduwitTsKXSp1VWZJ0SjEnJrqqPUM2L2cDBmT+A@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=pbonzini@redhat.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 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).