summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2010-03-01 00:08:59 +0000
committerPaul Brook <paul@codesourcery.com>2010-03-01 00:08:59 +0000
commita68fe89caf9e267672aedab578152664f1b8c09b (patch)
tree6efb384ce892f533cd52be1b850893207e5735d5 /exec.c
parent6d9a13042d3dab92418fb67e8d63126033fb11a6 (diff)
downloadqemu-a68fe89caf9e267672aedab578152664f1b8c09b.tar.gz
qemu-a68fe89caf9e267672aedab578152664f1b8c09b.tar.bz2
qemu-a68fe89caf9e267672aedab578152664f1b8c09b.zip
Remove bogus cpu_physical_memory_rw
Userspace doesn't have physical memory, so cpu_physical_memory_rw makes no sense. This is only used to implement cpu_memory_rw_debug, so just implement that directly instead. Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/exec.c b/exec.c
index 914d4e8ddb..2718b9a274 100644
--- a/exec.c
+++ b/exec.c
@@ -3106,8 +3106,8 @@ static void io_mem_init(void)
/* physical memory access (slow version, mainly for debug) */
#if defined(CONFIG_USER_ONLY)
-void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
- 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, flags;
target_ulong page;
@@ -3120,23 +3120,21 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
l = len;
flags = page_get_flags(page);
if (!(flags & PAGE_VALID))
- return;
+ return -1;
if (is_write) {
if (!(flags & PAGE_WRITE))
- return;
+ return -1;
/* XXX: this code should not depend on lock_user */
if (!(p = lock_user(VERIFY_WRITE, addr, l, 0)))
- /* FIXME - should this return an error rather than just fail? */
- return;
+ return -1;
memcpy(p, buf, l);
unlock_user(p, addr, l);
} else {
if (!(flags & PAGE_READ))
- return;
+ return -1;
/* XXX: this code should not depend on lock_user */
if (!(p = lock_user(VERIFY_READ, addr, l, 1)))
- /* FIXME - should this return an error rather than just fail? */
- return;
+ return -1;
memcpy(buf, p, l);
unlock_user(p, addr, 0);
}
@@ -3144,6 +3142,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
buf += l;
addr += l;
}
+ return 0;
}
#else
@@ -3641,8 +3640,6 @@ void stq_phys(target_phys_addr_t addr, uint64_t val)
cpu_physical_memory_write(addr, (const uint8_t *)&val, 8);
}
-#endif
-
/* virtual memory access for debug (includes writing to ROM) */
int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
uint8_t *buf, int len, int is_write)
@@ -3661,11 +3658,9 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
if (l > len)
l = len;
phys_addr += (addr & ~TARGET_PAGE_MASK);
-#if !defined(CONFIG_USER_ONLY)
if (is_write)
cpu_physical_memory_write_rom(phys_addr, buf, l);
else
-#endif
cpu_physical_memory_rw(phys_addr, buf, l, is_write);
len -= l;
buf += l;
@@ -3673,6 +3668,7 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
}
return 0;
}
+#endif
/* in deterministic execution mode, instructions doing device I/Os
must be at the end of the TB */