summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-26 20:01:13 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-26 20:01:13 +0000
commitd79acba420196a07f94b8d789972de7ff776f548 (patch)
tree5089730f8784869941f3472fed11f95f5d522c91
parent88fe8a41f2abbee28948626a4e6426d17f0498bf (diff)
downloadqemu-d79acba420196a07f94b8d789972de7ff776f548.tar.gz
Fix writes to pages containing watchpoints for the RAM not at 0x0 cases.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3025 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--cpu-defs.h2
-rw-r--r--exec.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/cpu-defs.h b/cpu-defs.h
index a19fef72d9..ac96b0ab53 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -141,7 +141,7 @@ typedef struct CPUTLBEntry {
\
struct { \
target_ulong vaddr; \
- int is_ram; \
+ target_phys_addr_t addend; \
} watchpoint[MAX_WATCHPOINTS]; \
int nb_watchpoints; \
int watchpoint_hit; \
diff --git a/exec.c b/exec.c
index c782e5b6b2..5fbeb8dce4 100644
--- a/exec.c
+++ b/exec.c
@@ -1626,17 +1626,18 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
for (i = 0; i < env->nb_watchpoints; i++) {
if (vaddr == (env->watchpoint[i].vaddr & TARGET_PAGE_MASK)) {
if (address & ~TARGET_PAGE_MASK) {
- env->watchpoint[i].is_ram = 0;
+ env->watchpoint[i].addend = 0;
address = vaddr | io_mem_watch;
} else {
- env->watchpoint[i].is_ram = 1;
+ env->watchpoint[i].addend = pd - paddr +
+ (unsigned long) phys_ram_base;
/* TODO: Figure out how to make read watchpoints coexist
with code. */
pd = (pd & TARGET_PAGE_MASK) | io_mem_watch | IO_MEM_ROMD;
}
}
}
-
+
index = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
addend -= vaddr;
te = &env->tlb_table[is_user][index];
@@ -2178,7 +2179,7 @@ static uint32_t watch_mem_readl(void *opaque, target_phys_addr_t addr)
/* Generate a debug exception if a watchpoint has been hit.
Returns the real physical address of the access. addr will be a host
- address in the is_ram case. */
+ address in case of a RAM location. */
static target_ulong check_watchpoint(target_phys_addr_t addr)
{
CPUState *env = cpu_single_env;
@@ -2190,8 +2191,7 @@ static target_ulong check_watchpoint(target_phys_addr_t addr)
for (i = 0; i < env->nb_watchpoints; i++) {
watch = env->watchpoint[i].vaddr;
if (((env->mem_write_vaddr ^ watch) & TARGET_PAGE_MASK) == 0) {
- if (env->watchpoint[i].is_ram)
- retaddr = addr - (unsigned long)phys_ram_base;
+ retaddr = addr - env->watchpoint[i].addend;
if (((addr ^ watch) & ~TARGET_PAGE_MASK) == 0) {
cpu_single_env->watchpoint_hit = i + 1;
cpu_interrupt(cpu_single_env, CPU_INTERRUPT_DEBUG);