Skip to contentSkip to conversation

[4628] kqemu API change - allow use of kqemu with 32 bit QEMU on a 64 bit host

Qemu-devel Fabrice Bellard 1 participant 1 message May 30, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4628

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4628
Author:   bellard
Date:     2008-05-30 20:48:25 +0000 (Fri, 30 May 2008)

Log Message:
-----------
kqemu API change - allow use of kqemu with 32 bit QEMU on a 64 bit host

Modified Paths:
--------------

    trunk/configure
    trunk/exec-all.h
    trunk/exec.c
    trunk/kqemu.c
    trunk/kqemu.h
    trunk/target-i386/op_helper.c

Modified: trunk/configure
===================================================================

configure +1 -1
@@ -1222,7 +1222,7 @@
     echo "TARGET_ARCH=i386" >> $config_mak
     echo "#define TARGET_ARCH \"i386\"" >> $config_h
     echo "#define TARGET_I386 1" >> $config_h
-    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386"
+    if test $kqemu = "yes" -a "$target_softmmu" = "yes"
     then
       echo "#define USE_KQEMU 1" >> $config_h
     fi

Modified: trunk/exec-all.h
===================================================================

exec-all.h +6 -0
@@ -563,15 +563,21 @@
 #ifdef USE_KQEMU
 #define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))
 
+#define MSR_QPI_COMMBASE 0xfabe0010
+
 int kqemu_init(CPUState *env);
 int kqemu_cpu_exec(CPUState *env);
 void kqemu_flush_page(CPUState *env, target_ulong addr);
 void kqemu_flush(CPUState *env, int global);
 void kqemu_set_notdirty(CPUState *env, ram_addr_t ram_addr);
 void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr);
+void kqemu_set_phys_mem(uint64_t start_addr, ram_addr_t size, 
+                        ram_addr_t phys_offset);
 void kqemu_cpu_interrupt(CPUState *env);
 void kqemu_record_dump(void);
 
+extern uint32_t kqemu_comm_base;
+
 static inline int kqemu_is_ok(CPUState *env)
 {
     return(env->kqemu_enabled &&

Modified: trunk/exec.c
===================================================================

exec.c +7 -0
@@ -2139,6 +2139,13 @@
     ram_addr_t orig_size = size;
     void *subpage;
 
+#ifdef USE_KQEMU
+    /* XXX: should not depend on cpu context */
+    env = first_cpu;
+    if (env->kqemu_enabled) {
+        kqemu_set_phys_mem(start_addr, size, phys_offset);
+    }
+#endif
     size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
     end_addr = start_addr + (target_phys_addr_t)size;
     for(addr = start_addr; addr != end_addr; addr += TARGET_PAGE_SIZE) {

Modified: trunk/kqemu.c
===================================================================

kqemu.c +180 -75

432 lines not on this page · raw message

Modified: trunk/kqemu.h
===================================================================

kqemu.h +70 -48

180 lines not on this page · raw message

Modified: trunk/target-i386/op_helper.c
===================================================================

target-i386/op_helper.c +21 -11
@@ -1950,20 +1950,21 @@
     case 0x80000008:
         /* virtual & phys address size in low 2 bytes. */
 /* XXX: This value must match the one used in the MMU code. */ 
-#if defined(TARGET_X86_64)
-#  if defined(USE_KQEMU)
-        EAX = 0x00003020;	/* 48 bits virtual, 32 bits physical */
-#  else
+        if (env->cpuid_ext2_features & CPUID_EXT2_LM) {
+            /* 64 bit processor */
+#if defined(USE_KQEMU)
+            EAX = 0x00003020;	/* 48 bits virtual, 32 bits physical */
+#else
 /* XXX: The physical address space is limited to 42 bits in exec.c. */
-        EAX = 0x00003028;	/* 48 bits virtual, 40 bits physical */
-#  endif
+            EAX = 0x00003028;	/* 48 bits virtual, 40 bits physical */
+#endif
+        } else {
+#if defined(USE_KQEMU)
+            EAX = 0x00000020;	/* 32 bits physical */
 #else
-# if defined(USE_KQEMU)
-        EAX = 0x00000020;	/* 32 bits physical */
-#  else
-        EAX = 0x00000024;	/* 36 bits physical */
-#  endif
+            EAX = 0x00000024;	/* 36 bits physical */
 #endif
+        }
         EBX = 0;
         ECX = 0;
         EDX = 0;
@@ -3158,6 +3159,15 @@
         val = env->kernelgsbase;
         break;
 #endif
+#ifdef USE_KQEMU
+    case MSR_QPI_COMMBASE:
+        if (env->kqemu_enabled) {
+            val = kqemu_comm_base;
+        } else {
+            val = 0;
+        }
+        break;
+#endif
     default:
         /* XXX: exception ? */
         val = 0;