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
This commit is contained in:
bellard 2004-02-25 23:24:04 +00:00
parent 97eb5b14dc
commit b448f2f36c
1 changed files with 19 additions and 9 deletions

28
exec.c
View File

@ -734,6 +734,7 @@ TranslationBlock *tb_alloc(unsigned long pc)
return NULL; return NULL;
tb = &tbs[nb_tbs++]; tb = &tbs[nb_tbs++];
tb->pc = pc; tb->pc = pc;
tb->cflags = 0;
return tb; return tb;
} }
@ -812,6 +813,11 @@ void tb_link(TranslationBlock *tb)
tb->jmp_first = (TranslationBlock *)((long)tb | 2); tb->jmp_first = (TranslationBlock *)((long)tb | 2);
tb->jmp_next[0] = NULL; tb->jmp_next[0] = NULL;
tb->jmp_next[1] = NULL; tb->jmp_next[1] = NULL;
#ifdef USE_CODE_COPY
tb->cflags &= ~CF_FP_USED;
if (tb->cflags & CF_TB_FP_USED)
tb->cflags |= CF_FP_USED;
#endif
/* init original jump addresses */ /* init original jump addresses */
if (tb->tb_next_offset[0] != 0xffff) if (tb->tb_next_offset[0] != 0xffff)
@ -1738,7 +1744,7 @@ int cpu_register_io_memory(int io_index,
/* physical memory access (slow version, mainly for debug) */ /* physical memory access (slow version, mainly for debug) */
#if defined(CONFIG_USER_ONLY) #if defined(CONFIG_USER_ONLY)
void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr, void cpu_physical_memory_rw(target_ulong addr, uint8_t *buf,
int len, int is_write) int len, int is_write)
{ {
int l, flags; int l, flags;
@ -1767,7 +1773,7 @@ void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
} }
} }
#else #else
void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr, void cpu_physical_memory_rw(target_ulong addr, uint8_t *buf,
int len, int is_write) int len, int is_write)
{ {
int l, io_index; int l, io_index;
@ -1808,10 +1814,15 @@ void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
l = 1; l = 1;
} }
} else { } else {
unsigned long addr1;
addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK);
/* RAM case */ /* RAM case */
ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + ptr = phys_ram_base + addr1;
(addr & ~TARGET_PAGE_MASK);
memcpy(ptr, buf, l); memcpy(ptr, buf, l);
/* invalidate code */
tb_invalidate_phys_page_range(addr1, addr1 + l, 0);
/* set dirty bit */
phys_ram_dirty[page >> TARGET_PAGE_BITS] = 1;
} }
} else { } else {
if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && 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,
#endif #endif
/* virtual memory access for debug */ /* virtual memory access for debug */
int cpu_memory_rw_debug(CPUState *env, int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
uint8_t *buf, target_ulong addr, int len, int is_write) uint8_t *buf, int len, int is_write)
{ {
int l; int l;
target_ulong page, phys_addr; target_ulong page, phys_addr;
@ -1864,9 +1875,8 @@ int cpu_memory_rw_debug(CPUState *env,
l = (page + TARGET_PAGE_SIZE) - addr; l = (page + TARGET_PAGE_SIZE) - addr;
if (l > len) if (l > len)
l = len; l = len;
cpu_physical_memory_rw(env, buf, cpu_physical_memory_rw(phys_addr + (addr & ~TARGET_PAGE_MASK),
phys_addr + (addr & ~TARGET_PAGE_MASK), l, buf, l, is_write);
is_write);
len -= l; len -= l;
buf += l; buf += l;
addr += l; addr += l;