Received: from eggs.gnu.org ([2001:4830:134:3::10]:54031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN26b-0002e2-2H for qemu-devel@nongnu.org; Mon, 10 Mar 2014 11:27:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WN26a-0001wP-9t for qemu-devel@nongnu.org; Mon, 10 Mar 2014 11:27:05 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:46626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN26a-0001wH-26 for qemu-devel@nongnu.org; Mon, 10 Mar 2014 11:27:04 -0400 From: Peter Maydell Date: Mon, 10 Mar 2014 15:09:12 +0000 Message-Id: <1394464160-9074-2-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1394464160-9074-1-git-send-email-peter.maydell@linaro.org> References: <1394464160-9074-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 1/9] target-arm: Fix incorrect setting of E bit in CPSR List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Blue Swirl , qemu-devel@nongnu.org, Aurelien Jarno Commit 4cc35614a moved the exception mask bits out of env->uncached_cpsr and into env->daif. However the env->daif contents are AArch64 style mask bits, which include not just the AArch32 AIF bits but also the new D bit (masks debug exceptions). This means that when reconstructing the AArch32 CPSR value we must not allow the D bit in env->daif to get into the CPSR, because the corresponding bit in the CPSR is E, the endianness bit. This bug didn't affect execution under TCG because we don't implement endianness-swapping and so simply ignored the E bit; however it meant that kernel booting under KVM failed, because KVM does honour the E bit. Reported-by: Alexey Ignatov Signed-off-by: Peter Maydell --- target-arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 90f85f1..d44e603 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2478,7 +2478,7 @@ uint32_t cpsr_read(CPUARMState *env) (env->CF << 29) | ((env->VF & 0x80000000) >> 3) | (env->QF << 27) | (env->thumb << 5) | ((env->condexec_bits & 3) << 25) | ((env->condexec_bits & 0xfc) << 8) - | (env->GE << 16) | env->daif; + | (env->GE << 16) | (env->daif & CPSR_AIF); } void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) -- 1.9.0