aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorJun Koi <junkoi2004@gmail.com>2010-05-06 14:36:59 +0900
committerAurelien Jarno <aurelien@aurel32.net>2010-06-30 20:25:55 +0200
commitbf298f83c35da854632c5be75733a4aa95a780bf (patch)
tree17a38e6d338aa55a64a73b81bae0727181a76f04 /exec.c
parent6fbab869257a87d9d80dec1a094827952448f27f (diff)
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 <junkoi2004@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/exec.c b/exec.c
index 7f64384c55..137175caa0 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;
+ }
}
}