From nobody Tue Feb 10 04:13:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537961663038218.62655269094262; Wed, 26 Sep 2018 04:34:23 -0700 (PDT) Received: from localhost ([::1]:57727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g585F-0000Vv-Td for importer@patchew.org; Wed, 26 Sep 2018 07:34:21 -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) 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) 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-Google-Smtp-Source: ACcGV63DvjDrjPZIo8zhjKdX/9bItRlZxnshJ0vS8HHsi109vXtkosQuVwjXYx9jRduSh73dE7E+NQ== X-Received: by 2002:adf:a41c:: with SMTP id d28-v6mr4498326wra.121.1537960850702; Wed, 26 Sep 2018 04:20:50 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=20Benn=C3=A9e?= , omair.javaid@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 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=C3=A9e --- target/arm/kvm64.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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)); } =20 +/* + * 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; =20 for (i =3D 0; i < cur_hw_bps; i++) { HWBreakpoint *bp =3D get_hw_bp(i); - if (bp->bvr =3D=3D pc) { + target_ulong bvr =3D bp->bvr; + bvr |=3D extract64(bvr, 52, 1) ? MAKE_64BIT_MASK(53, 11) : 0; + if (bvr =3D=3D pc) { return true; } } --=20 2.17.1