Received: from eggs.gnu.org ([2001:4830:134:3::10]:42687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFSMS-0004Ci-Q8 for qemu-devel@nongnu.org; Mon, 17 Feb 2014 12:52:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFSMR-0007Yg-8S for qemu-devel@nongnu.org; Mon, 17 Feb 2014 12:52:08 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:45975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFSMR-0007YS-1u for qemu-devel@nongnu.org; Mon, 17 Feb 2014 12:52:07 -0500 From: Peter Maydell Date: Mon, 17 Feb 2014 17:52:05 +0000 Message-Id: <1392659525-8335-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] target-arm: Fix incorrect arithmetic constructing short-form PAR for ATS ops List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org 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; -- 1.8.5