From: Jun Koi Date: Thu, 6 May 2010 05:36:59 +0000 (+0900) Subject: A bit optimization for tlb_set_page() X-Git-Tag: v0.13.0-rc0~148 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf298f83c35da854632c5be75733a4aa95a780bf;p=thirdparty%2Fqemu.git A bit optimization for tlb_set_page() This patch avoids handling write watchpoints on read-only memory access. It also breaks the searching loop for watchpoint once the setup for handling watchpoint later is done. Signed-off-by: Jun Koi Signed-off-by: Aurelien Jarno --- diff --git a/exec.c b/exec.c index 7f64384c550..137175caa0c 100644 --- a/exec.c +++ b/exec.c @@ -2209,10 +2209,12 @@ void tlb_set_page(CPUState *env, target_ulong vaddr, watchpoint trap routines. */ QTAILQ_FOREACH(wp, &env->watchpoints, entry) { if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) { - iotlb = io_mem_watch + paddr; - /* TODO: The memory case can be optimized by not trapping - reads of pages with a write breakpoint. */ - address |= TLB_MMIO; + /* Avoid trapping reads of pages with a write breakpoint. */ + if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) { + iotlb = io_mem_watch + paddr; + address |= TLB_MMIO; + break; + } } }