From patchwork Fri Mar 23 18:49:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132363 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp954142ljb; Fri, 23 Mar 2018 11:57:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELuYu8HVZgjOLsGTXZQOLFQtuFAzPSdrdLpb8tXB491nRuSonyPex9teV+rb7r2c3dJVjVFa X-Received: by 10.200.38.7 with SMTP id u7mr28082549qtu.269.1521831437764; Fri, 23 Mar 2018 11:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831437; cv=none; d=google.com; s=arc-20160816; b=n2SlIrUAGFWOBfDP+nPRat1B/6Zb+dmqAMPw/Mys2UueQoTOXshgRYtjqt3/d3SgRY s3AOiRa1n0vCETOOPG8tDbe/bfVeF5fCg60kB9S4MQ3Clrqw5QSGZgQZ0HbFjUpBEXGr O9s6VwJHHP5HhB0KBFU9oPLw08NGTyxg3reVXnbmnaufFveeFDxGQnEzbqS6EhpoH6+P 2czgJUKvIPSVvM5wUuM9Y6hiG+fyticJkkKP2noUwFGClwpjfPM1lBDU5UIwK5R2QZYp IOp3Gm1hvwAlGOVE83HfZEJzcqAgpWFZ128vzffWk+p/aS/dZlK1hNu/sGhufdma65R1 khFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=KPkUs7ZBMsr+1rvB66W/lPUGep2rseCGlUdU/KfzHIQ=; b=MAEeUYqf2EPrx65NGJ9YprnyAWWNSF/vgAQ7m3iTA9/OQnAsw981276cn0ZuZLkaFr AWz5UhaZaZWpe1D1ibtt8bJD0kGp/fK45n467MA2yNgWmughJ5UuGOO9vOWpnz9iUrQZ r2QYztr3vOTStt/7a8fP9IkimHUa12GfFljGbRtM7r4/UK7akdZAnNfIJ2RscsICldZR w3bpfDGj6tJz931bNVVqUJVekjOEV241FTuU92ho6MFgIp1pzozbns7ceMZ+5xYVcTvJ bDCeYD0CqM1G5H8znXX9NoFfHJX4Bgllt6scue3RPkZjVDpvI0Gr2eIPaU/4845/eNqL wKBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c20si1832631qtb.476.2018.03.23.11.57.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:57:17 -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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRsL-0006H1-9G for patch@linaro.org; Fri, 23 Mar 2018 14:57:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlR-00019O-C5 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlP-0004H9-04 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:08 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40514) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlO-0004GT-PS for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:06 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlN-0007hX-Mt for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:05 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:57 +0000 Message-Id: <20180323184958.14252-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 09/10] target/arm: Set FSR for BKPT, BRK when raising exception X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" Now that we have a helper function specifically for the BRK and BKPT instructions, we can set the exception.fsr there rather than in arm_cpu_do_interrupt_aarch32(). This allows us to use our new arm_debug_exception_fsr() helper. In particular this fixes a bug where we were hardcoding the short-form IFSR value, which is wrong if the target exception level has LPAE enabled. Fixes: https://bugs.launchpad.net/qemu/+bug/1756927 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20180320134114.30418-4-peter.maydell@linaro.org --- target/arm/helper.c | 1 - target/arm/op_helper.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) -- 2.16.2 diff --git a/target/arm/helper.c b/target/arm/helper.c index 09893e3f72..dcb8476d9e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7910,7 +7910,6 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) offset = 0; break; case EXCP_BKPT: - env->exception.fsr = 2; /* Fall through to prefetch abort. */ case EXCP_PREFETCH_ABORT: A32_BANKED_CURRENT_REG_SET(env, ifsr, env->exception.fsr); diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 75efff9edf..8e1e521193 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -488,6 +488,8 @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp, */ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) { + /* FSR will only be used if the debug target EL is AArch32. */ + env->exception.fsr = arm_debug_exception_fsr(env); raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env)); }