/[qemu]/qemu/exec.c
ViewVC logotype

Diff of /qemu/exec.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.63 by bellard, Sun Aug 21 09:26:42 2005 UTC revision 1.64 by bellard, Sun Aug 21 19:12:28 2005 UTC
# Line 1492  static void tlb_protect_code(CPUState *e Line 1492  static void tlb_protect_code(CPUState *e
1492      tlb_protect_code1(&env->tlb_write[0][i], vaddr);      tlb_protect_code1(&env->tlb_write[0][i], vaddr);
1493      tlb_protect_code1(&env->tlb_write[1][i], vaddr);      tlb_protect_code1(&env->tlb_write[1][i], vaddr);
1494    
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] &= ~CODE_DIRTY_FLAG;  
1495  #ifdef USE_KQEMU  #ifdef USE_KQEMU
1496      if (env->kqemu_enabled) {      if (env->kqemu_enabled) {
1497          kqemu_set_notdirty(env, ram_addr);          kqemu_set_notdirty(env, ram_addr);
1498      }      }
1499  #endif  #endif
1500        phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] &= ~CODE_DIRTY_FLAG;
1501            
1502  #if !defined(CONFIG_SOFTMMU)  #if !defined(CONFIG_SOFTMMU)
1503      /* NOTE: as we generated the code for this page, it is already at      /* NOTE: as we generated the code for this page, it is already at
# Line 1541  void cpu_physical_memory_reset_dirty(ram Line 1541  void cpu_physical_memory_reset_dirty(ram
1541      length = end - start;      length = end - start;
1542      if (length == 0)      if (length == 0)
1543          return;          return;
     mask = ~dirty_flags;  
     p = phys_ram_dirty + (start >> TARGET_PAGE_BITS);  
1544      len = length >> TARGET_PAGE_BITS;      len = length >> TARGET_PAGE_BITS;
     for(i = 0; i < len; i++)  
         p[i] &= mask;  
   
1545      env = cpu_single_env;      env = cpu_single_env;
1546  #ifdef USE_KQEMU  #ifdef USE_KQEMU
1547      if (env->kqemu_enabled) {      if (env->kqemu_enabled) {
1548          for(i = 0; i < len; i++)          ram_addr_t addr;
1549              kqemu_set_notdirty(env, (unsigned long)i << TARGET_PAGE_BITS);          addr = start;
1550            for(i = 0; i < len; i++) {
1551                kqemu_set_notdirty(env, addr);
1552                addr += TARGET_PAGE_SIZE;
1553            }
1554      }      }
1555  #endif  #endif
1556        mask = ~dirty_flags;
1557        p = phys_ram_dirty + (start >> TARGET_PAGE_BITS);
1558        for(i = 0; i < len; i++)
1559            p[i] &= mask;
1560    
1561      /* we modify the TLB cache so that the dirty bit will be set again      /* we modify the TLB cache so that the dirty bit will be set again
1562         when accessing the range */         when accessing the range */
1563      start1 = start + (unsigned long)phys_ram_base;      start1 = start + (unsigned long)phys_ram_base;
# Line 1633  static inline void tlb_set_dirty(unsigne Line 1637  static inline void tlb_set_dirty(unsigne
1637      CPUState *env = cpu_single_env;      CPUState *env = cpu_single_env;
1638      int i;      int i;
1639    
     phys_ram_dirty[(addr - (unsigned long)phys_ram_base) >> TARGET_PAGE_BITS] = 0xff;  
   
1640      addr &= TARGET_PAGE_MASK;      addr &= TARGET_PAGE_MASK;
1641      i = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);      i = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
1642      tlb_set_dirty1(&env->tlb_write[0][i], addr);      tlb_set_dirty1(&env->tlb_write[0][i], addr);
# Line 2005  static void notdirty_mem_writeb(void *op Line 2007  static void notdirty_mem_writeb(void *op
2007  #endif  #endif
2008      }      }
2009      stb_p((uint8_t *)(long)addr, val);      stb_p((uint8_t *)(long)addr, val);
2010      /* we set the page as dirty only if the code has been flushed */      dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
2011      if (dirty_flags & CODE_DIRTY_FLAG)      phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
2012        /* we remove the notdirty callback only if the code has been
2013           flushed */
2014        if (dirty_flags == 0xff)
2015          tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);          tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
2016  }  }
2017    
# Line 2023  static void notdirty_mem_writew(void *op Line 2028  static void notdirty_mem_writew(void *op
2028  #endif  #endif
2029      }      }
2030      stw_p((uint8_t *)(long)addr, val);      stw_p((uint8_t *)(long)addr, val);
2031      /* we set the page as dirty only if the code has been flushed */      dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
2032      if (dirty_flags & CODE_DIRTY_FLAG)      phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
2033        /* we remove the notdirty callback only if the code has been
2034           flushed */
2035        if (dirty_flags == 0xff)
2036          tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);          tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
2037  }  }
2038    
# Line 2041  static void notdirty_mem_writel(void *op Line 2049  static void notdirty_mem_writel(void *op
2049  #endif  #endif
2050      }      }
2051      stl_p((uint8_t *)(long)addr, val);      stl_p((uint8_t *)(long)addr, val);
2052      /* we set the page as dirty only if the code has been flushed */      dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
2053      if (dirty_flags & CODE_DIRTY_FLAG)      phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
2054        /* we remove the notdirty callback only if the code has been
2055           flushed */
2056        if (dirty_flags == 0xff)
2057          tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);          tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
2058  }  }
2059    
# Line 2207  void cpu_physical_memory_rw(target_phys_ Line 2218  void cpu_physical_memory_rw(target_phys_
2218                      /* invalidate code */                      /* invalidate code */
2219                      tb_invalidate_phys_page_range(addr1, addr1 + l, 0);                      tb_invalidate_phys_page_range(addr1, addr1 + l, 0);
2220                      /* set dirty bit */                      /* set dirty bit */
2221                      phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] = 0xff;                      phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] |=
2222                            (0xff & ~CODE_DIRTY_FLAG);
2223                  }                  }
2224              }              }
2225          } else {          } else {
# Line 2327  void stl_phys(target_phys_addr_t addr, u Line 2339  void stl_phys(target_phys_addr_t addr, u
2339              /* invalidate code */              /* invalidate code */
2340              tb_invalidate_phys_page_range(addr1, addr1 + 4, 0);              tb_invalidate_phys_page_range(addr1, addr1 + 4, 0);
2341              /* set dirty bit */              /* set dirty bit */
2342              phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] = 0xff;              phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] |=
2343                    (0xff & ~CODE_DIRTY_FLAG);
2344          }          }
2345      }      }
2346  }  }

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.64

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26