qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org,
	"Riku Voipio" <riku.voipio@iki.fi>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	greg.bellows@linaro.org
Subject: [Qemu-devel] [RCF PATCH 6/8] linux-user/main.c: __kernel_cmpxchg set env->CF directly
Date: Mon,  2 Jun 2014 17:22:00 +0100	[thread overview]
Message-ID: <1401726122-11132-7-git-send-email-alex.bennee@linaro.org> (raw)
In-Reply-To: <1401726122-11132-1-git-send-email-alex.bennee@linaro.org>

As we only need to manipulate the single flag do it directly though env.

---

Q: should we add a new flags only access functions?

diff --git a/linux-user/main.c b/linux-user/main.c
index 22d0197..5d9d5f7 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -469,7 +469,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 */
@@ -479,7 +479,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])) {
@@ -506,12 +505,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;
 
@@ -547,7 +545,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))
@@ -557,12 +554,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.0

  parent reply	other threads:[~2014-06-02 16:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02 16:21 [Qemu-devel] [RCF PATCH 0/8] aarch64 migration fixes and psr cleanup Alex Bennée
2014-06-02 16:21 ` [Qemu-devel] [RCF PATCH 1/8] target-arm/cpu.h: document various program state functions Alex Bennée
2014-06-02 16:40   ` Greg Bellows
2014-06-02 16:21 ` [Qemu-devel] [RCF PATCH 2/8] target-arm/cpu.h: implement common state save/restore Alex Bennée
2014-06-02 16:21 ` [Qemu-devel] [RCF PATCH 3/8] target-arm: Support save/load for 64 bit CPUs Alex Bennée
2014-06-02 16:21 ` [Qemu-devel] [RCF PATCH 4/8] target-arm: replace cpsr_read/pstate_read calls Alex Bennée
2014-06-02 16:21 ` [Qemu-devel] [RCF PATCH 5/8] arm/nwfps: remove use of cpsr_write() and set flags directly Alex Bennée
2014-06-03 16:11   ` Peter Maydell
2014-06-04 11:11     ` Alex Bennée
2014-06-04 13:10       ` Peter Maydell
2014-06-02 16:22 ` Alex Bennée [this message]
2014-06-02 16:22 ` [Qemu-devel] [RCF PATCH 7/8] target-arm: remove last users of cpsr_write Alex Bennée
2014-06-02 16:22 ` [Qemu-devel] [RCF PATCH 8/8] target-arm: remove final users of pstate_write Alex Bennée
2014-06-03 10:19   ` Alex Bennée

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=1401726122-11132-7-git-send-email-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=edgar.iglesias@xilinx.com \
    --cc=greg.bellows@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).