From patchwork Mon Feb 17 17:52:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 24785 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 58711202B2 for ; Mon, 17 Feb 2014 17:52:08 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id at1sf25251588iec.9 for ; Mon, 17 Feb 2014 09:52:07 -0800 (PST) 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:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=V9ihS1/07j1Hxo/2CTMOptPwj2WO3Pl20yu+hMQgoXE=; b=c5+ZhnaKfj/9gc+ZERzPzB6+LeicU1WC815vPFcHNu2BGvUHyPHdUN9o8GJ3M51G7S nn49BQn8jMuOGSQxtxifYUqOQBmLhaocyWJkfZUbqPsBxXzAutdA8UxBUq8/ux58oTm5 uUn0/sJnTmrPl2lU/15axzM18o1qscBnUUmus88ETOpdIM6tJkIt8KUojjc653iZwl07 tfVy+v09vgHue9UznVRo/DyRuItVopSUJpDALz168GqJDXyPUxXQ9bvDVYBlKnJSIO42 ststlnum8UrsKtrvtC6s1Ta8CeDUKqUNigObO2FMDAEJN14S921IQ00D3nLyGujD4V4B NdAQ== X-Gm-Message-State: ALoCoQlNjlO1eKWfdDaYvcq2O3Q3OD+tI3vlGERioDrbYBmYw3AnnFmZHj+4P6t92cJMNfoyX3Hv X-Received: by 10.183.3.36 with SMTP id bt4mr10673706obd.29.1392659527504; Mon, 17 Feb 2014 09:52:07 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.102 with SMTP id l93ls1008733qge.93.gmail; Mon, 17 Feb 2014 09:52:07 -0800 (PST) X-Received: by 10.53.9.107 with SMTP id dr11mr4977690vdd.1.1392659527393; Mon, 17 Feb 2014 09:52:07 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id sm10si4638297vec.81.2014.02.17.09.52.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Feb 2014 09:52:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ik5so12332024vcb.9 for ; Mon, 17 Feb 2014 09:52:07 -0800 (PST) X-Received: by 10.220.106.84 with SMTP id w20mr17920571vco.18.1392659527297; Mon, 17 Feb 2014 09:52:07 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp156783vcz; Mon, 17 Feb 2014 09:52:06 -0800 (PST) X-Received: by 10.194.75.225 with SMTP id f1mr2925639wjw.87.1392659526430; Mon, 17 Feb 2014 09:52:06 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id op5si11720361wjc.80.2014.02.17.09.52.05 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 17 Feb 2014 09:52:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WFSMP-0002Au-6g; Mon, 17 Feb 2014 17:52:05 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH] target-arm: Fix incorrect arithmetic constructing short-form PAR for ATS ops Date: Mon, 17 Feb 2014 17:52:05 +0000 Message-Id: <1392659525-8335-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Correct some obviously nonsensical bit manipulation spotted by Coverity when constructing the short-form PAR value for ATS operations. Signed-off-by: Peter Maydell --- Presumably most guests don't actually care what the exact cause of a fault was when the v-to-p translation they asked for comes back "nope"... target-arm/helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 5ae08c9..eb5f521 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1082,8 +1082,8 @@ static int ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) env->cp15.c7_par = phys_addr & 0xfffff000; } } else { - env->cp15.c7_par = ((ret & (10 << 1)) >> 5) | - ((ret & (12 << 1)) >> 6) | + env->cp15.c7_par = ((ret & (1 << 10)) >> 5) | + ((ret & (1 << 12)) >> 6) | ((ret & 0xf) << 1) | 1; } env->cp15.c7_par_hi = 0;