diff --git a/README.md b/README.md index 8a4b3dd..7a89340 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,13 @@ Use an administrator command console to execute "silent_install.bat" inside the driver package. Make sure you see the desired output from the installer: STATE: 4 RUNNING +## For Windows 7 users +According to Microsoft, SHA1 driver signing is deprecated (Read more +[here](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/deprecation-of-software-publisher-certificates-and-commercial-release-certificates) +). Version 1.8 (or above) cannot be loaded on Windows 7 by default. Please +use version 1.7 instead. Users may disable driver signature enforcement in +order to use version 1.8 or above. + ## Contributing If you would like to contribute a patch to the code base, please read [these guidelines](CONTRIBUTING.md). diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 5529e59..981e05d 100755 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -836,18 +836,33 @@ static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, } /* Fetch next part of the instruction being emulated. */ -#define __insn_fetch_type(_type) \ -static __always_inline int \ - __insn_fetch_##_type(struct x86_emulate_ctxt *ctxt, _type *_x) \ -{ \ - int rc; \ - rc = do_insn_fetch_bytes(ctxt, sizeof(_type)); \ - if (rc == X86EMUL_CONTINUE) { \ +#define __insn_fetch_type(_type) \ +static __always_inline int \ + __insn_fetch_##_type(struct x86_emulate_ctxt *ctxt, void *_x, unsigned _x_size) \ +{ \ + int rc; \ + rc = do_insn_fetch_bytes(ctxt, sizeof(_type)); \ + if (rc == X86EMUL_CONTINUE) { \ ctxt->_eip += sizeof(_type); \ - *_x = *(_type *) ctxt->fetch.ptr; \ + switch (_x_size) { \ + case 1: \ + *(u8 *)_x = *(_type *) ctxt->fetch.ptr; \ + break; \ + case 2: \ + *(u16 *)_x = *(_type *) ctxt->fetch.ptr;\ + break; \ + case 4: \ + *(u32 *)_x = *(_type *) ctxt->fetch.ptr;\ + break; \ + case 8: \ + *(u64 *)_x = *(_type *) ctxt->fetch.ptr;\ + break; \ + default: \ + BUG(); \ + } \ ctxt->fetch.ptr += sizeof(_type); \ - } \ - return rc; \ + } \ + return rc; \ } __insn_fetch_type(u8) @@ -859,7 +874,7 @@ __insn_fetch_type(s32) __insn_fetch_type(u64) __insn_fetch_type(s64) -#define insn_fetch(_type, _ctxt, _data) __insn_fetch_##_type(_ctxt, &(_type)_data) +#define insn_fetch(_type, _ctxt, _data) __insn_fetch_##_type(_ctxt, (void *)&_data, sizeof(_data)) #define insn_fetch_modrmea(_type, _ctxt) \ do { \ diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3afba02..9bad89f 100755 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -734,6 +734,12 @@ static u32 msrs_to_save[] = { static unsigned num_msrs_to_save; +static u32 emulated_msrs[] = { + MSR_IA32_SMBASE, +}; + +static unsigned num_emulated_msrs; + bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer) { if (efer & efer_reserved_bits) @@ -1348,7 +1354,7 @@ long kvm_arch_dev_ioctl(struct gvm_device_extension *devext, r = STATUS_SUCCESS; n = msr_list->nmsrs; - __u32 nmsrs = num_msrs_to_save; + __u32 nmsrs = num_msrs_to_save + num_emulated_msrs; r = gvmUpdateReturnBuffer(pIrp, 0, &nmsrs, sizeof(nmsrs)); if (r) goto out; @@ -1360,6 +1366,9 @@ long kvm_arch_dev_ioctl(struct gvm_device_extension *devext, r = gvmUpdateReturnBuffer(pIrp, sizeof(nmsrs), &msrs_to_save, num_msrs_to_save * sizeof(u32)); + + r = gvmUpdateReturnBuffer(pIrp, sizeof(nmsrs) + sizeof(u32) * num_msrs_to_save, + &emulated_msrs, num_emulated_msrs * sizeof(u32)); break; } case GVM_GET_SUPPORTED_CPUID: @@ -2381,7 +2390,6 @@ static void kvm_init_msr_list(void) } num_msrs_to_save = j; -#if 0 for (i = j = 0; i < ARRAY_SIZE(emulated_msrs); i++) { switch (emulated_msrs[i]) { case MSR_IA32_SMBASE: @@ -2397,7 +2405,6 @@ static void kvm_init_msr_list(void) j++; } num_emulated_msrs = j; -#endif } static int vcpu_mmio_write(struct kvm_vcpu *vcpu, gpa_t addr, int len, @@ -4721,6 +4728,12 @@ static int vcpu_run(struct kvm_vcpu *vcpu) vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); for (;;) { + if (test_and_clear_bit(0, (size_t *)&vcpu->run->user_event_pending)) { + r = 0; + vcpu->run->exit_reason = GVM_EXIT_INTR; + break; + } + if (kvm_vcpu_running(vcpu)) { r = vcpu_enter_guest(vcpu); } else { @@ -4741,11 +4754,6 @@ static int vcpu_run(struct kvm_vcpu *vcpu) ++vcpu->stat.request_irq_exits; break; } - if (test_and_clear_bit(0, (size_t *)&vcpu->run->user_event_pending)) { - r = 0; - vcpu->run->exit_reason = GVM_EXIT_INTR; - break; - } } srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); diff --git a/gvm/gvm.vcxproj b/gvm/gvm.vcxproj index ab038cf..57d474a 100755 --- a/gvm/gvm.vcxproj +++ b/gvm/gvm.vcxproj @@ -104,6 +104,10 @@ $(SolutionDir)\..\build\asmgen\x64\$(Configuration)\asmgen.exe > $(ProjectDir)..\__asm.inc + + + sha256 + @@ -117,6 +121,10 @@ $(ProjectDir)..\;%(IncludePaths) + + + sha256 + diff --git a/gvm_ver.h b/gvm_ver.h index bffea9a..17cd500 100644 --- a/gvm_ver.h +++ b/gvm_ver.h @@ -17,7 +17,7 @@ #define _XSTR(str) _STR(str) #define GVM_MAJOR_VERSION 1 -#define GVM_MINOR_VERSION 7 +#define GVM_MINOR_VERSION 8 #define GVM_VERSION ((GVM_MAJOR_VERSION << 16) | GVM_MINOR_VERSION) diff --git a/ntkrutils.c b/ntkrutils.c index df312b6..3f3f574 100644 --- a/ntkrutils.c +++ b/ntkrutils.c @@ -145,7 +145,7 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode m KeInitializeTimerEx(&timer->ktimer, SynchronizationTimer); timer->base = &timer->base_hack; timer->base->get_time = ktime_get; - KeInitializeDpc(&timer->kdpc, (PKDEFERRED_ROUTINE)timer_dpc_fn, timer); + KeInitializeThreadedDpc(&timer->kdpc, (PKDEFERRED_ROUTINE)timer_dpc_fn, timer); } int hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)