Commit b448f2f36c473f9ac8de4200a897268e0cf419c1

Authored by bellard
1 parent 97eb5b14

new physical memory access API (used by DMA accesses) - code copy FP fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@644 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 19 additions and 9 deletions
... ... @@ -734,6 +734,7 @@ TranslationBlock *tb_alloc(unsigned long pc)
734 734 return NULL;
735 735 tb = &tbs[nb_tbs++];
736 736 tb->pc = pc;
  737 + tb->cflags = 0;
737 738 return tb;
738 739 }
739 740  
... ... @@ -812,6 +813,11 @@ void tb_link(TranslationBlock *tb)
812 813 tb->jmp_first = (TranslationBlock *)((long)tb | 2);
813 814 tb->jmp_next[0] = NULL;
814 815 tb->jmp_next[1] = NULL;
  816 +#ifdef USE_CODE_COPY
  817 + tb->cflags &= ~CF_FP_USED;
  818 + if (tb->cflags & CF_TB_FP_USED)
  819 + tb->cflags |= CF_FP_USED;
  820 +#endif
815 821  
816 822 /* init original jump addresses */
817 823 if (tb->tb_next_offset[0] != 0xffff)
... ... @@ -1738,7 +1744,7 @@ int cpu_register_io_memory(int io_index,
1738 1744  
1739 1745 /* physical memory access (slow version, mainly for debug) */
1740 1746 #if defined(CONFIG_USER_ONLY)
1741   -void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
  1747 +void cpu_physical_memory_rw(target_ulong addr, uint8_t *buf,
1742 1748 int len, int is_write)
1743 1749 {
1744 1750 int l, flags;
... ... @@ -1767,7 +1773,7 @@ void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
1767 1773 }
1768 1774 }
1769 1775 #else
1770   -void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
  1776 +void cpu_physical_memory_rw(target_ulong addr, uint8_t *buf,
1771 1777 int len, int is_write)
1772 1778 {
1773 1779 int l, io_index;
... ... @@ -1808,10 +1814,15 @@ void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
1808 1814 l = 1;
1809 1815 }
1810 1816 } else {
  1817 + unsigned long addr1;
  1818 + addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK);
1811 1819 /* RAM case */
1812   - ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
1813   - (addr & ~TARGET_PAGE_MASK);
  1820 + ptr = phys_ram_base + addr1;
1814 1821 memcpy(ptr, buf, l);
  1822 + /* invalidate code */
  1823 + tb_invalidate_phys_page_range(addr1, addr1 + l, 0);
  1824 + /* set dirty bit */
  1825 + phys_ram_dirty[page >> TARGET_PAGE_BITS] = 1;
1815 1826 }
1816 1827 } else {
1817 1828 if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM &&
... ... @@ -1849,8 +1860,8 @@ void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
1849 1860 #endif
1850 1861  
1851 1862 /* virtual memory access for debug */
1852   -int cpu_memory_rw_debug(CPUState *env,
1853   - uint8_t *buf, target_ulong addr, int len, int is_write)
  1863 +int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
  1864 + uint8_t *buf, int len, int is_write)
1854 1865 {
1855 1866 int l;
1856 1867 target_ulong page, phys_addr;
... ... @@ -1864,9 +1875,8 @@ int cpu_memory_rw_debug(CPUState *env,
1864 1875 l = (page + TARGET_PAGE_SIZE) - addr;
1865 1876 if (l > len)
1866 1877 l = len;
1867   - cpu_physical_memory_rw(env, buf,
1868   - phys_addr + (addr & ~TARGET_PAGE_MASK), l,
1869   - is_write);
  1878 + cpu_physical_memory_rw(phys_addr + (addr & ~TARGET_PAGE_MASK),
  1879 + buf, l, is_write);
1870 1880 len -= l;
1871 1881 buf += l;
1872 1882 addr += l;
... ...