From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O9tlz-0007Jc-Ba for qemu-devel@nongnu.org; Thu, 06 May 2010 01:37:23 -0400 Received: from [140.186.70.92] (port=56660 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9tlx-0007HS-II for qemu-devel@nongnu.org; Thu, 06 May 2010 01:37:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O9tlw-0005ez-8m for qemu-devel@nongnu.org; Thu, 06 May 2010 01:37:21 -0400 Received: from mail-gx0-f209.google.com ([209.85.217.209]:53425) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9tlw-0005ev-61 for qemu-devel@nongnu.org; Thu, 06 May 2010 01:37:20 -0400 Received: by gxk1 with SMTP id 1so2274461gxk.16 for ; Wed, 05 May 2010 22:37:19 -0700 (PDT) MIME-Version: 1.0 From: Jun Koi Date: Thu, 6 May 2010 14:36:59 +0900 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] [PATCH] A bit optimization for tlb_set_page() (resend) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Jan Kiszka 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 diff --git a/exec.c b/exec.c index 14d1fd7..6fd859f 100644 --- a/exec.c +++ b/exec.c @@ -2236,10 +2236,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; + } } }