From patchwork Thu Jul 1 15:25:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469098 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp496130jao; Thu, 1 Jul 2021 08:26:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiARCv8hdRojNWveiLNRplOrLze0AbzpTzPaF+Li4D1XgTyKDJe+y5ysSo8aO4u1htdDDc X-Received: by 2002:a05:6402:845:: with SMTP id b5mr511839edz.266.1625153218017; Thu, 01 Jul 2021 08:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153218; cv=none; d=google.com; s=arc-20160816; b=meHzpvBhXQHvTWB3wWz/wTWIkAShI5vo2hHcUKVGpDIXtPHW9ajtIIBciUjR2cvQgG BDrj55bI+xrhre3kJ8AAx+P5q2GSgAedLXGPFNOH2L5A/456qFEURF4tbY7X51EqKzeX gKS8X/1H1IUZm6nPdOj0oIlA1ryjNy4mK1tdkQ+AmLDT4iRZZW5r0FNSP4bewhvbZfsz KYlMQSH1l3PsmqSaZa/KYzYtAMK50Eir0MDU2YdjwFmWx6pXg0b879wim0CLChMq093R NmPCnAZwmOFxEwRY2R17zXh/R7piOim9t/zGAb5yG2VHAssxhkWZQuMeKRyJULPAAbxU VIZw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=BiRmqcZNF2hJVvi+mtvT/dUtK5fKY7sdVO7TwBKWEiU=; b=f9cD5P1Y0RRdnKgGQ5aZv8onqGQVViOVkWy9BaC4FVXf5EBUvCmjmZjBssXWkc6enN Qcf3qJFNRTYaxe8pNtOIkTUupvB3k5dYcU/Bt1fnDRVN+raHlS657mOyJtPVLcbVAdTP 4v+ALFefLzulXrGIneL8W1SZLJbw+E1yYFR/2LKr3mtAG8hf+GOrnmi7PZ4EmS8U1Gtu QM/9tWWSVoiGJ2Z4/4FbQZgWAf7SbuV3UkzAPm/1zXKfekLBtYWlGCm+/e2ptrMG30iI J1aH8roR++HyxXXcmS3iXX27p+HCWej6slW69mxbwznhklIj9dNX7T1up85t40Szrcfw MlVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aN1KSX6A; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id bj22si315553ejb.53.2021.07.01.08.26.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:26:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aN1KSX6A; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:34400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyae-0004cq-RC for patch@linaro.org; Thu, 01 Jul 2021 11:26:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZZ-0004Od-V6 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:50 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:39522) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZS-00088e-7B for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:48 -0400 Received: by mail-pj1-x1029.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso6856963pjb.4 for ; Thu, 01 Jul 2021 08:25:40 -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=BiRmqcZNF2hJVvi+mtvT/dUtK5fKY7sdVO7TwBKWEiU=; b=aN1KSX6A5zT5OsJG+87PrIONda1RxJ77H2jH+QMO0/+DnA+Uk2XfeGyh+zyhtjOzvL trSDUiigqx1V+b13P6TCTd/ma8/IgcQgh7JqO3+nW+IaOK+EcEW+Q3A12aWoD6LXBckN npC5rCCFn0Ycq6ZCh9Q7yp5pbNCYuV9zwOZ4j9b6rJosgf8/JaG7NPZYjT6nKaRffIy5 9HTA/5A1DkkxvmcppVutwmOsaA7PBtbvXHhUb2GN8iVQAMhwGIGdglk13Ay+1SV3H3VK u5QieRd3zNRjtcrO4XE4bvbPN6Ra3oYXn3m0Mto+9wWSIfY7fj9LRS8UCYJvmOuUlEPq Gipw== 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=BiRmqcZNF2hJVvi+mtvT/dUtK5fKY7sdVO7TwBKWEiU=; b=qtEiJ28pratzLD/Z0N9IVupoYGz76bBZ+sY8qkUgJl9m4rzjGaGKvKOOgemV2GhKHJ fcL1nEDfGe5m/gHBa8BJqEMd9ByK3pN8OGLu3BDPHC/v4ScMhozOKO2L7Sf8nOc43+rt VxFcqKKj+G5pmuoAi7O3Uib0imIA4RislDmcmpxzXCROCgU3+s5PK4b+baj+anmyDx/8 RYVr2YuewJPIoVfwgtXzGsfUksjRHDCuTOShU9kUsx8lsyiXDLibTQP1PsslYNqcsPuT xsXnu58f/j7VUnIObxRUm3ldz4FunmuZOEglHMf0q8s09muDmZzLNcFGkyNdF0rL7xGt p+yg== X-Gm-Message-State: AOAM531OFi7FANwSuEE7PvieYH/3XCOnbcug2DkzO/oGKddLme3mCbgP OeNOrYjPcnkWfovsusii5CdMwwLcCUWXGQ== X-Received: by 2002:a17:90a:f485:: with SMTP id bx5mr268051pjb.194.1625153139431; Thu, 01 Jul 2021 08:25:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/17] target/i386: Use cpu_breakpoint_test in breakpoint_handler Date: Thu, 1 Jul 2021 08:25:21 -0700 Message-Id: <20210701152537.3330420-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The loop is performing a simple boolean test for the existence of a BP_CPU breakpoint at EIP. Plus it gets the iteration wrong, if we happen to have a BP_GDB breakpoint at the same address. We have a function for this: cpu_breakpoint_test. Signed-off-by: Richard Henderson --- target/i386/tcg/sysemu/bpt_helper.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/target/i386/tcg/sysemu/bpt_helper.c b/target/i386/tcg/sysemu/bpt_helper.c index 9bdf7e170b..f1fb479ad9 100644 --- a/target/i386/tcg/sysemu/bpt_helper.c +++ b/target/i386/tcg/sysemu/bpt_helper.c @@ -210,7 +210,6 @@ void breakpoint_handler(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; - CPUBreakpoint *bp; if (cs->watchpoint_hit) { if (cs->watchpoint_hit->flags & BP_CPU) { @@ -222,14 +221,9 @@ void breakpoint_handler(CPUState *cs) } } } else { - QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { - if (bp->pc == env->eip) { - if (bp->flags & BP_CPU) { - check_hw_breakpoints(env, true); - raise_exception(env, EXCP01_DB); - } - break; - } + if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) { + check_hw_breakpoints(env, true); + raise_exception(env, EXCP01_DB); } } }