Commit d79acba420196a07f94b8d789972de7ff776f548
1 parent
88fe8a41
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
Showing
2 changed files
with
7 additions
and
7 deletions
cpu-defs.h
exec.c
... | ... | @@ -1626,17 +1626,18 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr, |
1626 | 1626 | for (i = 0; i < env->nb_watchpoints; i++) { |
1627 | 1627 | if (vaddr == (env->watchpoint[i].vaddr & TARGET_PAGE_MASK)) { |
1628 | 1628 | if (address & ~TARGET_PAGE_MASK) { |
1629 | - env->watchpoint[i].is_ram = 0; | |
1629 | + env->watchpoint[i].addend = 0; | |
1630 | 1630 | address = vaddr | io_mem_watch; |
1631 | 1631 | } else { |
1632 | - env->watchpoint[i].is_ram = 1; | |
1632 | + env->watchpoint[i].addend = pd - paddr + | |
1633 | + (unsigned long) phys_ram_base; | |
1633 | 1634 | /* TODO: Figure out how to make read watchpoints coexist |
1634 | 1635 | with code. */ |
1635 | 1636 | pd = (pd & TARGET_PAGE_MASK) | io_mem_watch | IO_MEM_ROMD; |
1636 | 1637 | } |
1637 | 1638 | } |
1638 | 1639 | } |
1639 | - | |
1640 | + | |
1640 | 1641 | index = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); |
1641 | 1642 | addend -= vaddr; |
1642 | 1643 | te = &env->tlb_table[is_user][index]; |
... | ... | @@ -2178,7 +2179,7 @@ static uint32_t watch_mem_readl(void *opaque, target_phys_addr_t addr) |
2178 | 2179 | |
2179 | 2180 | /* Generate a debug exception if a watchpoint has been hit. |
2180 | 2181 | Returns the real physical address of the access. addr will be a host |
2181 | - address in the is_ram case. */ | |
2182 | + address in case of a RAM location. */ | |
2182 | 2183 | static target_ulong check_watchpoint(target_phys_addr_t addr) |
2183 | 2184 | { |
2184 | 2185 | CPUState *env = cpu_single_env; |
... | ... | @@ -2190,8 +2191,7 @@ static target_ulong check_watchpoint(target_phys_addr_t addr) |
2190 | 2191 | for (i = 0; i < env->nb_watchpoints; i++) { |
2191 | 2192 | watch = env->watchpoint[i].vaddr; |
2192 | 2193 | if (((env->mem_write_vaddr ^ watch) & TARGET_PAGE_MASK) == 0) { |
2193 | - if (env->watchpoint[i].is_ram) | |
2194 | - retaddr = addr - (unsigned long)phys_ram_base; | |
2194 | + retaddr = addr - env->watchpoint[i].addend; | |
2195 | 2195 | if (((addr ^ watch) & ~TARGET_PAGE_MASK) == 0) { |
2196 | 2196 | cpu_single_env->watchpoint_hit = i + 1; |
2197 | 2197 | cpu_interrupt(cpu_single_env, CPU_INTERRUPT_DEBUG); | ... | ... |