summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-02-25 23:24:04 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-02-25 23:24:04 +0000
commitb448f2f36c473f9ac8de4200a897268e0cf419c1 (patch)
tree1cc7285af27fd379e3c3fb4d5791e7360c66d77e /exec.c
parent97eb5b14dcfad346fa79e95e0e020aced9973311 (diff)
downloadqemu-b448f2f36c473f9ac8de4200a897268e0cf419c1.tar.gz
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
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/exec.c b/exec.c
index 06fc0429a0..b945c82718 100644
--- a/exec.c
+++ b/exec.c
@@ -734,6 +734,7 @@ TranslationBlock *tb_alloc(unsigned long pc)
return NULL;
tb = &tbs[nb_tbs++];
tb->pc = pc;
+ tb->cflags = 0;
return tb;
}
@@ -812,6 +813,11 @@ void tb_link(TranslationBlock *tb)
tb->jmp_first = (TranslationBlock *)((long)tb | 2);
tb->jmp_next[0] = 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 */
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) */
#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 l, flags;
@@ -1767,7 +1773,7 @@ void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
}
}
#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 l, io_index;
@@ -1808,10 +1814,15 @@ void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
l = 1;
}
} else {
+ unsigned long addr1;
+ addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK);
/* RAM case */
- ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
- (addr & ~TARGET_PAGE_MASK);
+ ptr = phys_ram_base + addr1;
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 {
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
/* virtual memory access for debug */
-int cpu_memory_rw_debug(CPUState *env,
- uint8_t *buf, target_ulong addr, int len, int is_write)
+int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
+ uint8_t *buf, int len, int is_write)
{
int l;
target_ulong page, phys_addr;
@@ -1864,9 +1875,8 @@ int cpu_memory_rw_debug(CPUState *env,
l = (page + TARGET_PAGE_SIZE) - addr;
if (l > len)
l = len;
- cpu_physical_memory_rw(env, buf,
- phys_addr + (addr & ~TARGET_PAGE_MASK), l,
- is_write);
+ cpu_physical_memory_rw(phys_addr + (addr & ~TARGET_PAGE_MASK),
+ buf, l, is_write);
len -= l;
buf += l;
addr += l;