[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 8/8] tcg: Check for watchpoints in probe_write()
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 8/8] tcg: Check for watchpoints in probe_write() |
Date: |
Wed, 28 Aug 2019 16:16:51 -0700 |
From: David Hildenbrand <address@hidden>
Let size > 0 indicate a promise to write to those bytes.
Check for write watchpoints in the probed range.
Suggested-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
Message-Id: <address@hidden>
[rth: Recompute index after tlb_fill; check TLB_WATCHPOINT.]
Signed-off-by: Richard Henderson <address@hidden>
---
accel/tcg/cputlb.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 9a9a626938..010c4c6e3c 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1086,13 +1086,24 @@ void probe_write(CPUArchState *env, target_ulong addr,
int size, int mmu_idx,
{
uintptr_t index = tlb_index(env, mmu_idx, addr);
CPUTLBEntry *entry = tlb_entry(env, mmu_idx, addr);
+ target_ulong tlb_addr = tlb_addr_write(entry);
- if (!tlb_hit(tlb_addr_write(entry), addr)) {
- /* TLB entry is for a different page */
+ if (unlikely(!tlb_hit(tlb_addr, addr))) {
if (!VICTIM_TLB_HIT(addr_write, addr)) {
tlb_fill(env_cpu(env), addr, size, MMU_DATA_STORE,
mmu_idx, retaddr);
+ /* TLB resize via tlb_fill may have moved the entry. */
+ index = tlb_index(env, mmu_idx, addr);
+ entry = tlb_entry(env, mmu_idx, addr);
}
+ tlb_addr = tlb_addr_write(entry);
+ }
+
+ /* Handle watchpoints. */
+ if ((tlb_addr & TLB_WATCHPOINT) && size > 0) {
+ cpu_check_watchpoint(env_cpu(env), addr, size,
+ env_tlb(env)->d[mmu_idx].iotlb[index].attrs,
+ BP_MEM_WRITE, retaddr);
}
}
--
2.17.1
- Re: [Qemu-devel] [PATCH v2 1/8] exec: Move user-only watchpoint stubs inline, (continued)
- [Qemu-devel] [PATCH v2 2/8] exec: Factor out core logic of check_watchpoint(), Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 3/8] cputlb: Fold TLB_RECHECK into TLB_INVALID_MASK, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 4/8] exec: Factor out cpu_watchpoint_address_matches, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 5/8] cputlb: Fix size operand for tlb_fill on unaligned store, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 6/8] cputlb: Remove double-alignment in store_helper, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 8/8] tcg: Check for watchpoints in probe_write(),
Richard Henderson <=
- [Qemu-devel] [PATCH v2 7/8] cputlb: Handle watchpoints via TLB_WATCHPOINT, Richard Henderson, 2019/08/28