--- kqemu/kqemu-doc.html Sun Jul 24 20:02:14 2005
+++ kqemu/kqemu-doc.html Wed Jul 27 23:20:28 2005
@@ -173,16 +173,7 @@ the option major=N
to set a
-Copy the kqemu driver `kqemu.sys' to -`c:\winnt\system32\drivers'. Then do: - -
-regedit kqemu.reg -- -
-Now kqemu is installed and you must restart your system. - +Right click on `kqemu.inf' in Explorer and choose Install.
In order to start kqemu, you must do: --- kqemu/kqemu-doc.texi Sun Jul 24 20:02:12 2005 +++ kqemu/kqemu-doc.texi Wed Jul 27 23:19:38 2005 @@ -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/kqemu-win32.c Sun Jul 24 19:39:55 2005 +++ kqemu/kqemu-win32.c Wed Jul 27 23:16:21 2005 @@ -36,6 +36,14 @@ typedef unsigned long long uint64_t; /* XXX: make it dynamic according to available RAM */ #define MAX_LOCKED_PAGES (16386 / 4) +struct kqemu_instance { + struct kqemu_state *state; + PIRP current_irp; +}; + +FAST_MUTEX instance_lock; +struct kqemu_instance *active_instance; + /* lock the page at virtual address 'user_addr' and return its page index. Return -1 if error */ struct kqemu_user_page *CDECL kqemu_lock_user_page(unsigned long *ppage_index, @@ -150,19 +158,19 @@ void CDECL kqemu_io_unmap(void *ptr, uns execution) */ int CDECL kqemu_schedule(void) { - /* XXX: do it */ - return TRUE; + return active_instance->current_irp->Cancel; } void CDECL kqemu_log(const char *fmt, ...) { - /* XXX: format parameters */ - DbgPrint("%s", fmt); -} + char log_buf[1024]; + va_list ap; -struct kqemu_instance { - struct kqemu_state *state; -}; + va_start(ap, fmt); + _vsnprintf(log_buf, sizeof(log_buf), fmt, ap); + DbgPrint("kqemu: %s", log_buf); + va_end(ap); +} NTSTATUS STDCALL KQemuCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) @@ -256,12 +264,19 @@ KQemuDeviceControl(PDEVICE_OBJECT Device break; } + ExAcquireFastMutex(&instance_lock); + active_instance = State; + State->current_irp = Irp; + ctx = kqemu_get_cpu_state(State->state); RtlCopyMemory(ctx, Irp->AssociatedIrp.SystemBuffer, sizeof(*ctx)); ret = kqemu_exec(State->state); RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, ctx, sizeof(*ctx)); + + ExReleaseFastMutex(&instance_lock); + Irp->IoStatus.Information = sizeof(*ctx); Status = STATUS_SUCCESS; } @@ -311,6 +326,8 @@ DriverEntry(PDRIVER_OBJECT DriverObject, (KQEMU_VERSION) & 0xff); MmLockPagableCodeSection(DriverEntry); + + ExInitializeFastMutex(&instance_lock); DriverObject->MajorFunction[IRP_MJ_CREATE] = KQemuCreate; DriverObject->MajorFunction[IRP_MJ_CLOSE] = KQemuClose; --- kqemu/kqemu.h Sun Jul 24 19:38:27 2005 +++ kqemu/kqemu.h Wed Jul 27 23:07:48 2005 @@ -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; --- kqemu/kqemu.inf Thu Jan 1 01:00:00 1970 +++ kqemu/kqemu.inf Wed Jul 27 22:34:39 2005 @@ -0,0 +1,64 @@ +; Copyright (C) 2005 Filip Navara, Damien Mascord + +[Version] +Signature = "$Windows NT$" +Class = System +ClassGuid = {4D36E97D-E325-11CE-BFC1-08002BE10318} +Provider = %Author% +DriverVer = 04/28/2005,1.0 + +[DestinationDirs] +DefaultDestDir = 12 +KQemu.DriverFiles = 12 +KQemu.InfFiles = 10,inf + +[SourceDisksNames] +1 = %InstDisk% + +[SourceDisksFiles] +kqemu.sys = 1 + +[Manufacturer] +%Author% = KQemu.Manufacturer + +[KQemu.Manufacturer] +%Description% = DefaultInstall,kqemu + +[DefaultInstall.NT] +CopyFiles = KQemu.DriverFiles, KQemu.InfFiles +AddReg = KQemu.UninstallRegistry + +[DefaultInstall.NT.Services] +AddService = kqemu,,KQemuService_Inst + +[Uninstall.NT] +DelFiles = KQemu.DriverFiles, KQemu.InfFiles +DelReg = KQemu.UninstallRegistry + +[Uninstall.NT.Services] +DelService = kqemu,0x00000200 + +[KQemu.DriverFiles] +kqemu.sys + +[KQemu.InfFiles] +kqemu.inf + +[KQemu.UninstallRegistry] +HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KQEMU,"DisplayName",,%Description% +HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KQEMU,"UninstallString",0x20000,"RunDll32 setupapi.dll,InstallHinfSection Uninstall 132 %SystemRoot%\inf\kqemu.inf" + +[KQemuService_Inst] +DisplayName = %Description% +ServiceType = %SERVICE_KERNEL_DRIVER% +StartType = %SERVICE_DEMAND_START% +ErrorControl = %SERVICE_ERROR_NORMAL% +ServiceBinary = %12%\kqemu.sys + +[Strings] +Author = "Fabrice Bellard" +Description = "KQEMU virtualisation module for QEMU" +InstDisk = "KQEMU Install Disk" +SERVICE_KERNEL_DRIVER = 1 +SERVICE_DEMAND_START = 3 +SERVICE_ERROR_NORMAL = 1 --- kqemu/kqemu.reg Tue Apr 12 23:24:49 2005 +++ /dev/null Wed Jul 27 23:24:00 2005 @@ -1,7 +0,0 @@ -REGEDIT4 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\kqemu] -"Type"=dword:00000001 -"Start"=dword:00000003 -"ErrorControl"=dword:00000001 -"DisplayName"="kqemu"