From patchwork Mon Jun 2 16:22:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 31294 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CE53E20AE6 for ; Mon, 2 Jun 2014 16:26:36 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 19sf14101308ykq.8 for ; Mon, 02 Jun 2014 09:26:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=zGAcD/Jt1/XqOi5Bk2IbFXcNZqkMZFY789qK4t2hj54=; b=CZFlpHJgkHTug2LmvJN7hTO+hO9+ZGx95dWybdnV4DUHKeYjFIFZyEUXQvypaZsL+x 3AKtZPDBrVBit2R5tB3vMfFe+qu3HOcE5fGj3HQqSAmds5KNv1XmOpM6Xj+aJpWWrCHC 3s5LeUNJFF3KRlh/Xn2OocbZmMr4tHsuykhG+g1ey4ayLopQTMRT12akn1h3oFFKly55 RElwyhze+2ot43587mzkHeYRaA/8jgtje2stjTM0ECQerycxjVKFXIRvHjyMPWS9jHb7 A629+vG7zEptdVVK2R1QVOQwv4mrqhbEKsgKj1IqV3FDKzOospWPs4LBDwq3bzFstopM d7Xw== X-Gm-Message-State: ALoCoQmeODm/r7jXSbSVIDTHhhucQ5eYSPT1qGlkHL65owRSBm5DX46KNSD3Q4AILewpLZMDH+qW X-Received: by 10.58.198.130 with SMTP id jc2mr15093000vec.9.1401726396421; Mon, 02 Jun 2014 09:26:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.183 with SMTP id 52ls2098363qgv.15.gmail; Mon, 02 Jun 2014 09:26:36 -0700 (PDT) X-Received: by 10.58.39.98 with SMTP id o2mr1310042vek.75.1401726396283; Mon, 02 Jun 2014 09:26:36 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id q6si8183105vcm.67.2014.06.02.09.26.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 09:26:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id lf12so5273662vcb.3 for ; Mon, 02 Jun 2014 09:26:36 -0700 (PDT) X-Received: by 10.52.25.130 with SMTP id c2mr21608558vdg.27.1401726396210; Mon, 02 Jun 2014 09:26:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp110316vcb; Mon, 2 Jun 2014 09:26:35 -0700 (PDT) X-Received: by 10.224.152.19 with SMTP id e19mr52331464qaw.94.1401726395696; Mon, 02 Jun 2014 09:26:35 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p10si18685122qag.0.2014.06.02.09.26.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Jun 2014 09:26:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:47762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrV4F-0001HL-26 for patch@linaro.org; Mon, 02 Jun 2014 12:26:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrV0e-0005Op-4t for qemu-devel@nongnu.org; Mon, 02 Jun 2014 12:22:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrV0W-0007Jn-Kb for qemu-devel@nongnu.org; Mon, 02 Jun 2014 12:22:52 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:41894 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrV0W-0007Ji-FO for qemu-devel@nongnu.org; Mon, 02 Jun 2014 12:22:44 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaro.local) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1WrV1f-0007B7-5W; Mon, 02 Jun 2014 18:23:55 +0200 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Mon, 2 Jun 2014 17:22:00 +0100 Message-Id: <1401726122-11132-7-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1401726122-11132-1-git-send-email-alex.bennee@linaro.org> References: <1401726122-11132-1-git-send-email-alex.bennee@linaro.org> X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: alex.bennee@linaro.org X-SA-Exim-Scanned: No (on socrates.bennee.com); SAEximRunCond expanded to false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 88.198.71.155 Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , greg.bellows@linaro.org Subject: [Qemu-devel] [RCF PATCH 6/8] linux-user/main.c: __kernel_cmpxchg set env->CF directly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 */