Skip to contentSkip to conversation

QVM86 / KQEMU for Windows updates

PATCH New Filip Navara 1 participant 1 message Jul 28, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 QVM86 / KQEMU for Windows updates

Changes:
- Implement the "scheduling" functions.
- Fix a bug which cause the driver to fail unloading on Win2K machines.
- Attempt to fix QVM86 on machines with NX support.
- Installation script.

Index: exec-all.h
===================================================================
RCS file: /cvsroot/qemu/qemu/exec-all.h,v
retrieving revision 1.34

exec-all.h +1 -0
diff -u -p -r1.34 exec-all.h
@@ -607,6 +607,7 @@ 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_cpu_interrupt(CPUState *env);
 
 static inline int kqemu_is_ok(CPUState *env)
 {

Index: kqemu.c
===================================================================
RCS file: /cvsroot/qemu/qemu/kqemu.c,v
retrieving revision 1.4

kqemu.c +17 -5
diff -u -p -r1.4 kqemu.c
@@ -456,11 +456,14 @@ int kqemu_cpu_exec(CPUState *env)
     }
 
 #ifdef _WIN32
-    DeviceIoControl(kqemu_fd, KQEMU_EXEC,
-		    kenv, sizeof(struct kqemu_cpu_state),
-		    kenv, sizeof(struct kqemu_cpu_state),
-		    &temp, NULL);
-    ret = kenv->retval;
+    if (DeviceIoControl(kqemu_fd, KQEMU_EXEC,
+                        kenv, sizeof(struct kqemu_cpu_state),
+                        kenv, sizeof(struct kqemu_cpu_state),
+                        &temp, NULL)) {
+        ret = kenv->retval;
+    } else {
+        ret = -1;
+    }
 #else
 #if KQEMU_VERSION >= 0x010100
     ioctl(kqemu_fd, KQEMU_EXEC, kenv);
@@ -544,6 +547,15 @@ int kqemu_cpu_exec(CPUState *env)
         exit(1);
     }
     return 0;
+}
+
+void kqemu_cpu_interrupt(CPUState *env)
+{
+#if defined(_WIN32) && KQEMU_VERSION >= 0x010101
+    /* cancelling the I/O request causes KQEMU to finish executing the 
+       current block and successfully returning. */
+    CancelIo(kqemu_fd);
+#endif
 }
 
 #endif

Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.133

vl.c +3 -0
diff -u -p -r1.133 vl.c
@@ -875,6 +875,9 @@ static void host_alarm_handler(int host_
                            qemu_get_clock(rt_clock))) {
         /* stop the cpu because a timer occured */
         cpu_interrupt(global_env, CPU_INTERRUPT_EXIT);
+#ifdef USE_KQEMU
+        kqemu_cpu_interrupt(global_env);
+#endif
     }
 }
 
kqemu-doc.html +1 -10
@@ -173,16 +173,7 @@ the option <CODE>major=N</CODE> to set a
 <H2><A NAME="SEC5" HREF="kqemu-doc.html#TOC5">2.3 QEMU Accelerator Installation for Windows</A></H2>
 
 <P>
-Copy the kqemu driver <TT>`kqemu.sys'</TT> to
-<TT>`c:\winnt\system32\drivers'</TT>.  Then do:
-
-<PRE>
-regedit kqemu.reg 
-</PRE>
-
-<P>
-Now kqemu is installed and you must restart your system.
-
+Right click on <TT>`kqemu.inf'</TT> in Explorer and choose Install.
 
 <P>
 In order to start kqemu, you must do:
kqemu-doc.texi +1 -7
@@ -112,13 +112,7 @@ the option @code{major=N} to set an alte
 
 @section QEMU Accelerator Installation for Windows
 
-Copy the kqemu driver @file{kqemu.sys} to
-@file{c:\winnt\system32\drivers}.  Then do:
-@example
-regedit kqemu.reg 
-@end example
-
-Now kqemu is installed and you must restart your system.
+Right click on @file{kqemu.inf} in Explorer and choose Install.
 
 In order to start kqemu, you must do:
 @example
kqemu-win32.c +38 -9

103 lines not on this page · raw message

kqemu.h +1 -1
@@ -1,7 +1,7 @@
 #ifndef KQEMU_H
 #define KQEMU_H
 
-#define KQEMU_VERSION 0x010100
+#define KQEMU_VERSION 0x010101
 
 struct kqemu_segment_cache {
     uint32_t selector;

Index: ChangeLog
===================================================================
RCS file: /cvsroot/qvm86/qvm86/ChangeLog,v
retrieving revision 1.20

ChangeLog +9 -1
diff -u -p -r1.20 ChangeLog
@@ -1,3 +1,11 @@
+2005-07-28  Filip Navara  <[email protected]>
+
+	* qvm86-win32.c (KQemuUnload): Correctly delete symlink on
+	driver unload.
+	(host_do_sched): Implement.
+	(host_alloc_pages, host_free_pages): Experimental fix for machines
+	with NX support.
+
 2005-06-18  Paul Brook  <[email protected]>
 
 	* qvm86-host.c (rdtsc): Move inside #ifdef QVM86_PROFILE.
@@ -6,7 +14,7 @@
 	(qvm86_clear_gdt_entries): New function.
 	(qvm86_setup_monitor_idt): Return immediately if nothing to do.
 	(qvm86_shadow_fault): Update comments.
-	(qvm86_handle_exception): Remove debugging code.  Contuinue execution
+	(qvm86_handle_exception): Remove debugging code.  Continue execution
 	after a hardware interrupt when possible.  Use new gdt clearing code.
 	* qvm86-linux.c (host_do_sched): New function.
 	* qvm86-win32.c (host_do_sched): New function.

Index: README
===================================================================
RCS file: /cvsroot/qvm86/qvm86/README,v
retrieving revision 1.5

README +5 -5
diff -u -p -r1.5 README
@@ -26,11 +26,11 @@ can find it.  You need to manually load 
 QVM86 uses a dynamic misc device minor.  If you are using devfs or udev then
 /dev/qvm86 should be created automatically when you load the module.
 
-On Windows hosts you need to copy qvm86.sys to windows/system32/drivers, apply
-qvm86.reg and do "net start qvm86".  Windows host support is extremely
-experimental.  The windows code has been built with the mingw32 toolchains.
-It is possible to compile on cygwin, but some hacking of makefiles is
-required to ensure -mno-cygwin is used.
+On Windows hosts you right click on qvm86.inf and choose Install and then
+do "net start qvm86".  Windows host support is extremely experimental. 
+The windows code has been built with the mingw32 toolchains. It is possible
+to compile on cygwin, but some hacking of makefiles is required to ensure
+-mno-cygwin is used.
 
 WARNING: QVM86 is still in the early stages of development.
 It may crash your machine or cause data corruption.  Do NOT use it on any

Index: kqemu.h
===================================================================
RCS file: /cvsroot/qvm86/qvm86/kqemu.h,v
retrieving revision 1.3

kqemu.h +4 -0
diff -u -p -r1.3 kqemu.h
@@ -1,7 +1,11 @@
 #ifndef KQEMU_H
 #define KQEMU_H
 
+#ifdef _WIN32
+#define KQEMU_VERSION 0x010101
+#else
 #define KQEMU_VERSION 0x010000
+#endif
 
 struct kqemu_segment_cache {
     uint32_t selector;

Index: qvm86-host.c
===================================================================
RCS file: /cvsroot/qvm86/qvm86/qvm86-host.c,v
retrieving revision 1.11

qvm86-host.c +1 -1
diff -u -p -r1.11 qvm86-host.c
@@ -832,7 +832,7 @@ qvm86_handle_exception (qvm86_state * qs
       soft_int (vector);
       /* Return to userspace if there are signals pending, otherwise
          resume guest execution.  */
-      if (host_do_sched())
+      if (host_do_sched(qs))
 	return 2;
       else
 	return 0;

Index: qvm86-linux.c
===================================================================
RCS file: /cvsroot/qvm86/qvm86/qvm86-linux.c,v
retrieving revision 1.5

qvm86-linux.c +1 -1
diff -u -p -r1.5 qvm86-linux.c
@@ -67,7 +67,7 @@ MODULE_LICENSE("GPL");
 /* Give other tasks a chance to run.  Returns nonzero if this task has
    signals pending.  */
 int
-host_do_sched()
+host_do_sched (qvm86_state *qs)
 {
   if (need_resched())
       schedule();

Index: qvm86-win32.c
===================================================================
RCS file: /cvsroot/qvm86/qvm86/qvm86-win32.c,v
retrieving revision 1.4

qvm86-win32.c +68 -10

128 lines not on this page · raw message

Index: qvm86.h
===================================================================
RCS file: /cvsroot/qvm86/qvm86/qvm86.h,v
retrieving revision 1.4

qvm86.h +4 -1
diff -u -p -r1.4 qvm86.h
@@ -244,6 +244,9 @@ typedef struct
   /* This will be nonzero if a fatal error occured.  Usually due to
      something not yet implemented.  Ideally this would never happen.  */
   int die;
+
+  /* This pointer is exclusively for use by specific host code. */
+  void *host_opaque;
 } qvm86_state;
 
 void qvm86_init (qvm86_state * qs, struct kqemu_init * init);
@@ -252,7 +255,7 @@ void qvm86_init_device (qvm86_state *);
 void qvm86_cleanup_device (qvm86_state *);
 /* Give other tasks a chance to run.  Returns nonzero if this task has
    signals pending.  */
-int host_do_sched(void);
+int host_do_sched (qvm86_state *);
 /* Allocate a contiguous block of physical memory.  The returned block must
    be suitable for use with host_phys_addr.  */
 void * host_alloc_pages (int);

Index: qvm86.reg
===================================================================
RCS file: /cvsroot/qvm86/qvm86/qvm86.reg,v
retrieving revision 1.1

qvm86.reg deleted +0 -1
diff -u -p -r1.1 qvm86.reg
@@ -1,7 +0,0 @@
-REGEDIT4

-

-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\qvm86]

-"Type"=dword:00000001

-"Start"=dword:00000003

-"ErrorControl"=dword:00000001

-"DisplayName"="qvm86"