From patchwork Wed Sep 26 11:20:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 147565 Delivered-To: patch@linaro.org Received: by 2002:aa7:da13:0:0:0:0:0 with SMTP id r19-v6csp656659eds; Wed, 26 Sep 2018 04:35:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV60FjUjo9PcGU151/e+7lX9nXxP6lOGupM7mAgBdlthmaM7OVwr2Fzt/wX2c+gqRzrpxxI0G X-Received: by 2002:ac8:2b1a:: with SMTP id 26-v6mr4030632qtu.119.1537961714661; Wed, 26 Sep 2018 04:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537961714; cv=none; d=google.com; s=arc-20160816; b=dA1+F9FSN0rxxcF7e8QAl+u61qQZGEuMOovA1Pgx6R+p1xOm3rpu7v5OFvxon9vqxF 04+nGkOieiuYl8gtKHQHSOufNp0RNcpBJ15tWZbfr3FXN/uhJCgxsX2kmiAm2MDsTG8B dUOJYZwg/GZ4Y49T1xIdkUwxbxaz0greuFZCogRX8KZ0uvOazNm1eassx1fbHNCLdJ4n BytjJjIds5MzyCZQSW6rzW/x/LVQSjNikmRUsw6xwXZaWYDASTQlo8QxQZdpHcgTHguG H1QuzA4qCyvEgUEEk9JF/rAnfbAdA3hK/NHpif93773bdz6GiJ7mAdqiyAf0dxsV6QWJ SSMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:dkim-signature; bh=c1TtMpNWiIdsGsSiS7XKTtv5r1DIlenBS3nmVtddTDY=; b=F4oPmEpgHfPeRc0jUMZ+XGAyV3txvLWB9joF07nZ1Wzxr4oD3GR/qqCQGqBoUONf4f XRpCdCiie1iHPzmjwjS+2qdydJFt+HAV/Rl9fn4clTxT185cVa0ofTBNLWJpwbNrQb6k ykTnhIAyS7NKrQfBNgRqbD6g9TfmV6ZYF0b1wwnfi5NPQ5jB2pp+EVarzno154h9oSXW qUr0WVJlbQHdpc44lrG2VnfCRbeNyjZJsJdVxmAyerWIBb6e9rNy3v/zNxYp0LR2MUop a7XkjvQaqocnR76dmo9/1kB9+IpAmJrFoZR+CD1QZyWc/qxgOL8jHJ5yauTXOAIdDy22 NXyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Nu1+DBc0; 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 i5-v6si1084641qvq.227.2018.09.26.04.35.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 26 Sep 2018 04:35:14 -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; dkim=fail header.i=@linaro.org header.s=google header.b=Nu1+DBc0; 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]:57741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5866-0001gW-6A for patch@linaro.org; Wed, 26 Sep 2018 07:35:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g582d-0006Gz-Pm for qemu-devel@nongnu.org; Wed, 26 Sep 2018 07:31:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g57sC-00015S-F3 for qemu-devel@nongnu.org; Wed, 26 Sep 2018 07:20:55 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:39973) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g57sC-00013v-4C for qemu-devel@nongnu.org; Wed, 26 Sep 2018 07:20:52 -0400 Received: by mail-wr1-x431.google.com with SMTP id y8-v6so22955437wrh.7 for ; Wed, 26 Sep 2018 04:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c1TtMpNWiIdsGsSiS7XKTtv5r1DIlenBS3nmVtddTDY=; b=Nu1+DBc09obYKqxblu255CGzYSMdR92Hcrlr/M+lr6MoXRnH6RNNjALBhhnQZbmDYp my3li9UK5Uqhw9piLn2wKBEbfes54ppnexkkUnJXTtibW2Cmy0TFSDUs2uXHGNx3IdXo NkZ8E9THwklJB/ky2fxk8PiXYOOwuISqtz+Io= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c1TtMpNWiIdsGsSiS7XKTtv5r1DIlenBS3nmVtddTDY=; b=cG9JP8h7yMH8jhYkHjgjivzAUL+vQaRHwl0MJSaC7fBM6Gjj7PPrGSRHQqdCwcnxha dJEv6uS3tZjdEIyzGMmU/HCWam2Xe/kfEwzQqMun0C9XQEtT1iGxUgZVrAenwJ3KltnD wY4JOVHWOFL2pfDqNrWk3nlqEsQ3bJ9KoNN+TuWzQxWLRcqGbixKEwotdJ/q2YbStlIj 79R0ItGSRKvR5Kczle4Frc2zLfkI62TlPtoj0AbSDKds/emoDmV7yCJSx8NzkdYeBuL5 W//H1eB26VW2a75uAD/a/OpcQf61nAYh1X48naO1YIEJECNWlEN2Dz394qLJGna4lgTt Irag== X-Gm-Message-State: ABuFfohM9ougNYoUoH06tBI7kDsSa+nFsI/Kr3Vf3tvxk/WeQfub+D28 u8a81NapdgbgoRjyscdRC0xxSw== X-Received: by 2002:adf:a41c:: with SMTP id d28-v6mr4498326wra.121.1537960850702; Wed, 26 Sep 2018 04:20:50 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x16-v6sm3506705wro.84.2018.09.26.04.20.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 04:20:49 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id A89AA3E0403; Wed, 26 Sep 2018 12:20:48 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 26 Sep 2018 12:20:45 +0100 Message-Id: <20180926112048.17778-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926112048.17778-1-alex.bennee@linaro.org> References: <20180926112048.17778-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 Subject: [Qemu-devel] [PATCH v1 1/4] target/arm64: properly handle DBGVR RESS bits 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: , Cc: ard.biesheuvel@linaro.org, Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , omair.javaid@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This only fails with some (broken) versions of gdb but we should treat the top bits of DBGBVR as RESS. As the hardware may have IMPDEF approaches to writes to this register we apply the sign extension when checking breakpoints. Signed-off-by: Alex Bennée --- target/arm/kvm64.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index e0b8246283..80ad07ed0c 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -356,13 +356,23 @@ bool kvm_arm_hw_debug_active(CPUState *cs) return ((cur_hw_wps > 0) || (cur_hw_bps > 0)); } +/* + * We shouldn't rely on gdb correctly setting the top bits of DBGBVR + * and the HW lists the top bits a RESS - sign-extending the top bit + * of the VA address. As it is IMPDEF if the write is either a sign + * extension or kept as is we might fix it up before we compare with + * the correctly reported and sign extended address. + */ + static bool find_hw_breakpoint(CPUState *cpu, target_ulong pc) { int i; for (i = 0; i < cur_hw_bps; i++) { HWBreakpoint *bp = get_hw_bp(i); - if (bp->bvr == pc) { + target_ulong bvr = bp->bvr; + bvr |= extract64(bvr, 52, 1) ? MAKE_64BIT_MASK(53, 11) : 0; + if (bvr == pc) { return true; } }