From: Richard Henderson <richard.henderson@linaro.org>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com,
bmeng@tinylab.org, liwei1518@gmail.com,
zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com
Subject: Re: [PATCH] target/riscv: throw debug exception before page fault
Date: Mon, 20 Jan 2025 09:28:14 -0800 [thread overview]
Message-ID: <37ea5a30-8d23-497c-819a-281e0e856eca@linaro.org> (raw)
In-Reply-To: <20250120133949.1019000-1-dbarboza@ventanamicro.com>
On 1/20/25 05:39, Daniel Henrique Barboza wrote:
> @@ -1708,10 +1709,25 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
> } else if (probe) {
> return false;
> } else {
> - raise_mmu_exception(env, address, access_type, pmp_violation,
> - first_stage_error, two_stage_lookup,
> - two_stage_indirect_error);
> - cpu_loop_exit_restore(cs, retaddr);
> + CPUWatchpoint *wp = riscv_cpu_addr_has_watchpoint(env, address);
> + int wp_access = 0;
> +
> + if (wp) {
> + if (access_type == MMU_DATA_LOAD) {
> + wp_access |= BP_MEM_READ;
> + } else if (access_type == MMU_DATA_STORE) {
> + wp_access |= BP_MEM_WRITE;
> + }
> +
> + cpu_check_watchpoint(cs, address, wp->len,
> + MEMTXATTRS_UNSPECIFIED,
> + wp_access, retaddr);
> + } else {
No point in walking the watchpoint list twice:
cpu_check_watchpoint(cs, address, size, MEMTXATTRS_UNSPECIFIED,
wp_access, retaddr);
will return if and only if there is no wp match.
Then just fall through to ...
> + raise_mmu_exception(env, address, access_type, pmp_violation,
> + first_stage_error, two_stage_lookup,
> + two_stage_indirect_error);
> + cpu_loop_exit_restore(cs, retaddr);
... this.
r~
parent reply other threads:[~2025-01-20 17:29 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20250120133949.1019000-1-dbarboza@ventanamicro.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37ea5a30-8d23-497c-819a-281e0e856eca@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=bmeng@tinylab.org \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.com \
--cc=palmer@rivosinc.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).