From patchwork Thu Jul 10 15:50:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 33460 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A1BCC203C0 for ; Thu, 10 Jul 2014 22:05:20 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id j107sf521711qga.8 for ; Thu, 10 Jul 2014 15:05:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version: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:content-type :content-transfer-encoding; bh=GJQyXqECAMkKNEt5y/afZ5kZffJLFjXOtFWe7mArvUE=; b=FwICIUW0QeQH0mkTcOwE5kQp6XmiahocKp+DTfnnpNrtXxW4rFvi5w3QMtkLxhnEK1 ccQFKQZtwW44Ln/17W/yH1ju7K6LXI7A21dhpkyvz68JMeMnU3vofrhO4xtWVEmOwyKH M5J4juF7KKhUCq2kaIQuDOlT5o9SB2oiM8v6oVFZfqokdN0Ji9wZr7wBdoQFu2uT/CX8 CACpqqVK5ykhA1ogRr/YE27L0Q10mxH3ZR9WUvEsQxpJ6lPW4W1PIMCeTHGTP9YMcRPL Bf+h7gNlMNl5b/EojeME6d/HA2hYh2yWpwobY96RK4nFFFMF1DAWW9Oj47uKbYEcVJUZ O3NA== X-Gm-Message-State: ALoCoQk8zsokHz15m7TJl91rUqwETC2aXAlAzQrBWJXw7lSdUjz+VhhlZl3S3zgrivaHpTUXG/tR X-Received: by 10.236.204.38 with SMTP id g26mr21144206yho.43.1405029920380; Thu, 10 Jul 2014 15:05:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.8 with SMTP id v8ls221670qge.15.gmail; Thu, 10 Jul 2014 15:05:20 -0700 (PDT) X-Received: by 10.52.231.226 with SMTP id tj2mr27100577vdc.16.1405029920253; Thu, 10 Jul 2014 15:05:20 -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 xe6si297212vcb.28.2014.07.10.15.05.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Jul 2014 15:05:20 -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 hy10so474923vcb.17 for ; Thu, 10 Jul 2014 15:05:20 -0700 (PDT) X-Received: by 10.58.134.81 with SMTP id pi17mr23867974veb.14.1405029920179; Thu, 10 Jul 2014 15:05:20 -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.221.37.5 with SMTP id tc5csp171135vcb; Thu, 10 Jul 2014 15:05:19 -0700 (PDT) X-Received: by 10.224.11.196 with SMTP id u4mr28973713qau.101.1405029919566; Thu, 10 Jul 2014 15:05:19 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a7si590316qat.99.2014.07.10.15.05.19 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 10 Jul 2014 15:05:19 -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]:38679 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5Gf6-0002ca-Vl for patch@linaro.org; Thu, 10 Jul 2014 11:53:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5Gba-0001gk-BK for qemu-devel@nongnu.org; Thu, 10 Jul 2014 11:49:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5GbU-00071N-PS for qemu-devel@nongnu.org; Thu, 10 Jul 2014 11:49:54 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:35652 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5GbU-00071E-5e for qemu-devel@nongnu.org; Thu, 10 Jul 2014 11:49:48 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaro.local) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1X5GgK-0007L4-Or; Thu, 10 Jul 2014 17:54:48 +0200 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 10 Jul 2014 16:50:03 +0100 Message-Id: <1405007407-23549-7-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1405007407-23549-1-git-send-email-alex.bennee@linaro.org> References: <1405007407-23549-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 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: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [Qemu-devel] [PATCH v2 06/10] 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. Signed-off-by: Alex Bennée Acked-by: Riku Voipio --- 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 */