From patchwork Fri Aug 29 11:21:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 36280 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 89440202DD for ; Fri, 29 Aug 2014 11:25:45 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id a108sf8005097qge.8 for ; Fri, 29 Aug 2014 04:25:45 -0700 (PDT) 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:date :message-id:in-reply-to:references: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; bh=29UuSvBIdMQPPgLY/fEcfRUC8EmNImohYkOlFoYdU54=; b=fSGy7W8/Fm5L5rIfMzE2b9MMXPHIeLxHBQ5kPr0lTMWIQmknuppalS/bmwBIJwn4ka dKdyKbxaogUDzQSlaUQH7aD/zVFdCg1IQXLeOrrfsh65YGrDcfKdWeYEarageBbIrNZQ Un8lClBriPqAKnR/53QNkXZD6ILS1nPAbq0VMobsi5+Be6UI4clJSTBA+MM900GBRiYr 0ar1Nqp4Ny4oNvz61qUNGo2KR/fXWJKmsqamy3VyUtkLYc3XnE1M3tAxQtaSeHKyV+ct t/nFQjmbtHO8QfApUa6kuIdQuMwOpRQgEj/nQDhmxGbH4PJDc8nJ1r6XuRKqlstZJiKo 1Q+A== X-Gm-Message-State: ALoCoQnL1P7TxMdkwmnFcYUvBrW3ygDZ44f0ufb/o9sO3QyUjBW40v1qs1uorru8sMWtA+3+G9/M X-Received: by 10.236.118.195 with SMTP id l43mr173990yhh.52.1409311545415; Fri, 29 Aug 2014 04:25:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.245 with SMTP id d108ls208562qgd.68.gmail; Fri, 29 Aug 2014 04:25:45 -0700 (PDT) X-Received: by 10.52.102.204 with SMTP id fq12mr1608637vdb.26.1409311545324; Fri, 29 Aug 2014 04:25:45 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id xm1si3199393vdc.62.2014.08.29.04.25.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Aug 2014 04:25:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so2272197vcb.2 for ; Fri, 29 Aug 2014 04:25:45 -0700 (PDT) X-Received: by 10.52.248.232 with SMTP id yp8mr145883vdc.83.1409311545267; Fri, 29 Aug 2014 04:25:45 -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.45.67 with SMTP id uj3csp403vcb; Fri, 29 Aug 2014 04:25:44 -0700 (PDT) X-Received: by 10.140.105.37 with SMTP id b34mr15395331qgf.1.1409311544873; Fri, 29 Aug 2014 04:25:44 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a1si9726944qae.107.2014.08.29.04.25.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 29 Aug 2014 04:25:44 -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]:41407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNKJM-0003rK-Dn for patch@linaro.org; Fri, 29 Aug 2014 07:25:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNKGb-0007eF-QY for qemu-devel@nongnu.org; Fri, 29 Aug 2014 07:22:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNKGV-00073C-9R for qemu-devel@nongnu.org; Fri, 29 Aug 2014 07:22:53 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:46718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNKGV-00070y-1P for qemu-devel@nongnu.org; Fri, 29 Aug 2014 07:22:47 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1XNKFI-0004vB-H0; Fri, 29 Aug 2014 12:21:32 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 29 Aug 2014 12:21:30 +0100 Message-Id: <1409311292-18860-9-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1409311292-18860-1-git-send-email-peter.maydell@linaro.org> References: <1409311292-18860-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 81.2.115.146 Cc: Paolo Bonzini , Richard Henderson , =?UTF-8?q?Andreas=20F=C3=A4rber?= , patches@linaro.org Subject: [Qemu-devel] [PATCH 08/10] target-arm: Set DBGDSCR.MOE for debug exceptions taken to AArch32 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: peter.maydell@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.171 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 For debug exceptions taken to AArch32 we have to set the DBGDSCR.MOE (Method Of Entry) bits; we can identify the kind of debug exception from the information in exception.syndrome. Signed-off-by: Peter Maydell --- target-arm/helper.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/target-arm/helper.c b/target-arm/helper.c index 40dde9c..ef1eac9 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -3563,11 +3563,37 @@ void arm_cpu_do_interrupt(CPUState *cs) uint32_t mask; int new_mode; uint32_t offset; + uint32_t moe; assert(!IS_M(env)); arm_log_exception(cs->exception_index); + /* If this is a debug exception we must update the DBGDSCR.MOE bits */ + switch (env->exception.syndrome >> ARM_EL_EC_SHIFT) { + case EC_BREAKPOINT: + case EC_BREAKPOINT_SAME_EL: + moe = 1; + break; + case EC_WATCHPOINT: + case EC_WATCHPOINT_SAME_EL: + moe = 10; + break; + case EC_AA32_BKPT: + moe = 3; + break; + case EC_VECTORCATCH: + moe = 5; + break; + default: + moe = 0; + break; + } + + if (moe) { + env->cp15.mdscr_el1 = deposit64(env->cp15.mdscr_el1, 2, 4, moe); + } + /* TODO: Vectored interrupt controller. */ switch (cs->exception_index) { case EXCP_UDEF: