From patchwork Wed Mar 11 06:44:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 184391 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp280952ile; Tue, 10 Mar 2020 23:49:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvLTe19t/svn6sKetGKy4JXUWf8xSlwxbzdErhL7jPXXZWsAL2KEumQIRd+5VL6N41WdhyR X-Received: by 2002:ac8:6f70:: with SMTP id u16mr153833qtv.355.1583909389348; Tue, 10 Mar 2020 23:49:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583909389; cv=none; d=google.com; s=arc-20160816; b=nPoYAS4KhSJO/qzwJD576SErrUvwQjidDui1QSTnPmEcApwySW0f4jd1KBYvtqW8KU l5Bdck1eDP2DEfab44a+CtvBRGoPR7Omq6fft3ko3FTqLFZMlomy6Xuug7ICxiyvq1oq VU7SQyeazudNChrVO5dezH5k1TaZsHm5amlccirVuND64ZiZC949rFYME4/YVghAN71G kR4bE625D1xGYGXc8gQ96LRJ0T2gfdtoMPaM9YQnapLkQ4z1Uw/grZHvP42wHMfKzcQ9 riPHaw7xrlAyJJ/ruHNk0b6KT+LA5/cmxj/006UKfuMBhcWbNid4HcDm9ek9LbAH8iL4 zMRw== 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=B3XDGQrOIHo2Z/Fxm4hqpcuhDa9MTHMM7/GJHSmNf48=; b=xlsfb/LXEleM5XLqqANsIp0DT6M5vxX2aaVhWouDeAqwSH4jHNbGH7MTMyugMiHi01 JruNhzxSX0mE7A5oNLgxaN0iNCV1kMsgrHWz5qQD47dnpAov9mOSjA++Uz+ZQkiAE9pl /knqDAKKFAulN9ObJHb3Ac52rFN0Pe0ItmgtS6LvVqQHe/lv7IKfvrBVIGSgyAyEDo9U jaIg67YW3gJduZ11SCpSCKu2tVZ4P4SW6p8q2c6ecQn7euNF5oSHC/AFpwQstR8/hRcD 8H/Jz/s9AVJEDvT3psAxCYpa4nyd+dzNkLVG1QDWnLWlPYU11q6vDbSTAhyF4RDojfSa 7w4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GshumYDG; 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=pass (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 z10si465295qkl.68.2020.03.10.23.49.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Mar 2020 23:49:49 -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=pass header.i=@linaro.org header.s=google header.b=GshumYDG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBvBc-0005q7-TU for patch@linaro.org; Wed, 11 Mar 2020 02:49:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59349) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBv6U-00067p-0u for qemu-devel@nongnu.org; Wed, 11 Mar 2020 02:44:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBv6S-0001nR-9i for qemu-devel@nongnu.org; Wed, 11 Mar 2020 02:44:29 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:36474) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jBv6S-0001hI-4P for qemu-devel@nongnu.org; Wed, 11 Mar 2020 02:44:28 -0400 Received: by mail-pg1-x542.google.com with SMTP id c7so645489pgw.3 for ; Tue, 10 Mar 2020 23:44:26 -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=B3XDGQrOIHo2Z/Fxm4hqpcuhDa9MTHMM7/GJHSmNf48=; b=GshumYDGLFLuvesKBTQC9q0ilBA4N4T54w6gyQPr9gXCq4SD15BazgVA4Dze02YJEj RdGGW+qMy4eYhuAM0HTSXQYYOVfGekhn8MoWFP3NgI0+Zy0pi69L6o9X5xJJ+qruIMw4 dYH1Q8KSF1a6SwDOgg8y3js+Ib15hBL3oSa3V4M5tqp5C6pD5AIRJuxNY0GSDRpKkukt 4dDaPwC5j+or5ACIrzO0WHc0CQ6kE3Iojl84TVuDMy9u9ffvwHxcipzjndCplSySkJ6u dkGCMiaURON6IW0WxGhs1uTyMSL4kQhHmqUsoLARvngm3bTwVE4Cnn/CGh7RMRP1Zkmw DskA== 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=B3XDGQrOIHo2Z/Fxm4hqpcuhDa9MTHMM7/GJHSmNf48=; b=p/S70XvQ0F9fNM120i7gJOynfNH79XUsrFMZawi0+3M/htGclLPl6r80S33aR5vOMR W65/7pfSFsyUOrvTuwU3XHOfcm3+wn9/qojXsBUi9P6ZpFrzkslGrSmwJGZnv0Etrqkx HZAZZDYEiXSADCdCsBKxqB1kNGZvqUXAC3uBVEQO7uYIfdx6FNXcuMc+ZxgwFf5UGRww SUidxA4ica+ucIzL1bmoYNX1rLAZAuROcqU/WHTHTXjiy/hWTPCmO8lx8McAwq32pZ+j S9eMyoPDDpKCsdsthbdo8UocyCTe0OrTL5gJunwdDPTATnw1NBIWMhSYz75/CngZG8cg Q3Rg== X-Gm-Message-State: ANhLgQ0V8zPOtg0/cgOnwnRewbK2eOB5RNEFGM4ReSwwhNbjawbaats0 mBTcEUJ78dRqBuCeeJ/aQHcF6txKsXA= X-Received: by 2002:aa7:9732:: with SMTP id k18mr1368276pfg.231.1583909065441; Tue, 10 Mar 2020 23:44:25 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id z3sm50137807pfz.155.2020.03.10.23.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 23:44:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/16] exec: Add cpu_probe_watchpoint Date: Tue, 10 Mar 2020 23:44:07 -0700 Message-Id: <20200311064420.30606-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311064420.30606-1-richard.henderson@linaro.org> References: <20200311064420.30606-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 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, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Allow probing of a watchpoint *without* raising an exception. This is of most use for no-fault loads, which should indicate via some architectural means that the load did not occur. Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 7 +++++++ exec.c | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) -- 2.20.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 73e9a869a4..8ec44267a4 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1090,6 +1090,12 @@ static inline void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, { } +static inline bool cpu_probe_watchpoint(CPUState *cpu, vaddr addr, vaddr len, + int flags) +{ + return false; +} + static inline int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len) { @@ -1104,6 +1110,7 @@ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint); void cpu_watchpoint_remove_all(CPUState *cpu, int mask); void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, MemTxAttrs attrs, int flags, uintptr_t ra); +bool cpu_probe_watchpoint(CPUState *cpu, vaddr addr, vaddr len, int flags); int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len); #endif diff --git a/exec.c b/exec.c index 0cc500d53a..2b8f601b9e 100644 --- a/exec.c +++ b/exec.c @@ -2735,6 +2735,25 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, } } +bool cpu_probe_watchpoint(CPUState *cpu, vaddr addr, vaddr len, int flags) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + CPUWatchpoint *wp; + + assert(tcg_enabled()); + + addr = cc->adjust_watchpoint_address(cpu, addr, len); + QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) { + if (watchpoint_address_matches(wp, addr, len) && + (wp->flags & flags) && + (!(wp->flags & BP_CPU) || + !cc->debug_check_watchpoint(cpu, wp))) { + return true; + } + } + return false; +} + static MemTxResult flatview_read(FlatView *fv, hwaddr addr, MemTxAttrs attrs, void *buf, hwaddr len); static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,