Disable phsyical memory handling in userspace emulation.
authorPaul Brook <paul@codesourcery.com>
Fri, 12 Mar 2010 16:54:58 +0000 (16:54 +0000)
committerPaul Brook <paul@codesourcery.com>
Fri, 12 Mar 2010 18:34:25 +0000 (18:34 +0000)
Code to handle physical memory access is not meaningful in usrmode emulation,
so disable it.

Signed-off-by: Paul Brook <paul@codesourcery.com>
cpu-all.h
cpu-common.h
exec-all.h
exec.c
kvm.h

index a51b301..e32ea47 100644 (file)
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -849,6 +849,8 @@ void cpu_set_log(int log_flags);
 void cpu_set_log_filename(const char *filename);
 int cpu_str_to_log_mask(const char *str);
 
+#if !defined(CONFIG_USER_ONLY)
+
 /* memory API */
 
 extern int phys_ram_fd;
@@ -877,9 +879,6 @@ extern int mem_prealloc;
 /* Set if TLB entry is an IO callback.  */
 #define TLB_MMIO        (1 << 5)
 
-int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
-                        uint8_t *buf, int len, int is_write);
-
 #define VGA_DIRTY_FLAG       0x01
 #define CODE_DIRTY_FLAG      0x02
 #define MIGRATION_DIRTY_FLAG 0x08
@@ -926,6 +925,11 @@ void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
 
 void qemu_flush_coalesced_mmio_buffer(void);
 
+#endif /* !CONFIG_USER_ONLY */
+
+int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
+                        uint8_t *buf, int len, int is_write);
+
 /*******************************************/
 /* host CPU ticks (if available) */
 
index 0ec9b72..f53690a 100644 (file)
@@ -10,6 +10,8 @@
 #include "bswap.h"
 #include "qemu-queue.h"
 
+#if !defined(CONFIG_USER_ONLY)
+
 /* address in the RAM (different from a physical address) */
 typedef unsigned long ram_addr_t;
 
@@ -106,4 +108,6 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr,
 #define IO_MEM_SUBPAGE     (2)
 #define IO_MEM_SUBWIDTH    (4)
 
+#endif
+
 #endif /* !CPU_COMMON_H */
index 04d2146..6c44d32 100644 (file)
@@ -274,10 +274,6 @@ static inline void tb_add_jump(TranslationBlock *tb, int n,
 
 TranslationBlock *tb_find_pc(unsigned long pc_ptr);
 
-extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];
-extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
-extern void *io_mem_opaque[IO_MEM_NB_ENTRIES];
-
 #include "qemu-lock.h"
 
 extern spinlock_t tb_lock;
@@ -286,6 +282,10 @@ extern int tb_invalidated_flag;
 
 #if !defined(CONFIG_USER_ONLY)
 
+extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];
+extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
+extern void *io_mem_opaque[IO_MEM_NB_ENTRIES];
+
 void tlb_fill(target_ulong addr, int is_write, int mmu_idx,
               void *retaddr);
 
diff --git a/exec.c b/exec.c
index c7697ac..e9cec6a 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -217,7 +217,9 @@ int loglevel;
 static int log_append = 0;
 
 /* statistics */
+#if !defined(CONFIG_USER_ONLY)
 static int tlb_flush_count;
+#endif
 static int tb_flush_count;
 static int tb_phys_invalidate_count;
 
@@ -3924,6 +3926,8 @@ void cpu_io_recompile(CPUState *env, void *retaddr)
     cpu_resume_from_signal(env, NULL);
 }
 
+#if !defined(CONFIG_USER_ONLY)
+
 void dump_exec_info(FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
 {
@@ -3977,8 +3981,6 @@ void dump_exec_info(FILE *f,
     tcg_dump_info(f, cpu_fprintf);
 }
 
-#if !defined(CONFIG_USER_ONLY)
-
 #define MMUSUFFIX _cmmu
 #define GETPC() NULL
 #define env cpu_single_env
diff --git a/kvm.h b/kvm.h
index b2937b9..fd8d0c1 100644 (file)
--- a/kvm.h
+++ b/kvm.h
@@ -35,6 +35,7 @@ int kvm_init_vcpu(CPUState *env);
 
 int kvm_cpu_exec(CPUState *env);
 
+#if !defined(CONFIG_USER_ONLY)
 int kvm_log_start(target_phys_addr_t phys_addr, ram_addr_t size);
 int kvm_log_stop(target_phys_addr_t phys_addr, ram_addr_t size);
 
@@ -47,6 +48,7 @@ void kvm_setup_guest_memory(void *start, size_t size);
 int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size);
 int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size);
 void kvm_flush_coalesced_mmio_buffer(void);
+#endif
 
 int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr,
                           target_ulong len, int type);