From: Riku Voipio <riku.voipio@iki.fi>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: Riku Voipio <riku.voipio@iki.fi>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 06/10] linux-user/main.c: __kernel_cmpxchg set env->CF directly
Date: Tue, 15 Jul 2014 16:39:23 +0300 [thread overview]
Message-ID: <20140715133923.GE607@afflict.kos.to> (raw)
In-Reply-To: <1405007407-23549-7-git-send-email-alex.bennee@linaro.org>
On Thu, Jul 10, 2014 at 04:50:03PM +0100, Alex Bennée wrote:
> As we only need to manipulate the single flag do it directly though env.
Acked-by: Riku Voipio <riku.voipio@linaro.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>
> ---
>
> v2:
> - remove unused cpsr
> - the direct flag setting seems a little hacky?
>
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 8848e15..9101541 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -468,7 +468,7 @@ void cpu_loop(CPUX86State *env)
> static void arm_kernel_cmpxchg64_helper(CPUARMState *env)
> {
> uint64_t oldval, newval, val;
> - uint32_t addr, cpsr;
> + uint32_t addr;
> target_siginfo_t info;
>
> /* Based on the 32 bit code in do_kernel_trap */
> @@ -478,7 +478,6 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env)
> operations. However things like ldrex/strex are much harder so
> there's not much point trying. */
> start_exclusive();
> - cpsr = cpsr_read(env);
> addr = env->regs[2];
>
> if (get_user_u64(oldval, env->regs[0])) {
> @@ -505,12 +504,11 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env)
> };
>
> env->regs[0] = 0;
> - cpsr |= CPSR_C;
> + env->CF = 1;
> } else {
> env->regs[0] = -1;
> - cpsr &= ~CPSR_C;
> + env->CF = 0;
> }
> - cpsr_write(env, cpsr, CPSR_C);
> end_exclusive();
> return;
>
> @@ -533,7 +531,6 @@ static int
> do_kernel_trap(CPUARMState *env)
> {
> uint32_t addr;
> - uint32_t cpsr;
> uint32_t val;
>
> switch (env->regs[15]) {
> @@ -546,7 +543,6 @@ do_kernel_trap(CPUARMState *env)
> operations. However things like ldrex/strex are much harder so
> there's not much point trying. */
> start_exclusive();
> - cpsr = save_state_to_spsr(env);
> addr = env->regs[2];
> /* FIXME: This should SEGV if the access fails. */
> if (get_user_u32(val, addr))
> @@ -556,12 +552,11 @@ do_kernel_trap(CPUARMState *env)
> /* FIXME: Check for segfaults. */
> put_user_u32(val, addr);
> env->regs[0] = 0;
> - cpsr |= CPSR_C;
> + env->CF = 1;
> } else {
> env->regs[0] = -1;
> - cpsr &= ~CPSR_C;
> + env->CF = 0;
> }
> - cpsr_write(env, cpsr, CPSR_C);
> end_exclusive();
> break;
> case 0xffff0fe0: /* __kernel_get_tls */
> --
> 2.0.1
>
next prev parent reply other threads:[~2014-07-15 13:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 15:49 [Qemu-devel] [PATCH v2 00/10] aarch64 migration for TCG and KVM Alex Bennée
2014-07-10 15:49 ` [Qemu-devel] [PATCH v2 01/10] target-arm/cpu.h: document various program state functions Alex Bennée
2014-08-04 12:28 ` Peter Maydell
2014-07-10 15:49 ` [Qemu-devel] [PATCH v2 02/10] target-arm/cpu.h: common pstate save/restore Alex Bennée
2014-08-04 12:47 ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 03/10] target-arm: Support save/load for 64 bit CPUs Alex Bennée
2014-08-04 12:50 ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 04/10] target-arm: replace cpsr/xpsr/pstate_read calls Alex Bennée
2014-07-15 13:40 ` Riku Voipio
2014-08-04 12:59 ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 05/10] arm/nwfps: replace cpsr_write with set_condition_codes Alex Bennée
2014-07-15 13:41 ` Riku Voipio
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 06/10] linux-user/main.c: __kernel_cmpxchg set env->CF directly Alex Bennée
2014-07-15 13:39 ` Riku Voipio [this message]
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 07/10] target-arm: remove last users of cpsr_write Alex Bennée
2014-07-15 13:43 ` Riku Voipio
2014-08-04 13:01 ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 08/10] target-arm: remove final users of pstate_write Alex Bennée
2014-07-15 13:44 ` Riku Voipio
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 09/10] target-arm/kvm.c: better error reporting Alex Bennée
2014-08-04 13:03 ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 10/10] target-arm/kvm: make reg sync code common between kvm32/64 Alex Bennée
2014-08-04 13:04 ` Peter Maydell
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=20140715133923.GE607@afflict.kos.to \
--to=riku.voipio@iki.fi \
--cc=alex.bennee@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 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).