Skip to content

Commit 8b469a8

Browse files
authored
Merge branch 'google:master' into master
2 parents a561986 + 30350bf commit 8b469a8

File tree

6 files changed

+59
-21
lines changed

6 files changed

+59
-21
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ Use an administrator command console to execute "silent_install.bat" inside
2727
the driver package. Make sure you see the desired output from the installer:
2828
STATE: 4 RUNNING
2929

30+
## For Windows 7 users
31+
According to Microsoft, SHA1 driver signing is deprecated (Read more
32+
[here](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/deprecation-of-software-publisher-certificates-and-commercial-release-certificates)
33+
). Version 1.8 (or above) cannot be loaded on Windows 7 by default. Please
34+
use version 1.7 instead. Users may disable driver signature enforcement in
35+
order to use version 1.8 or above.
36+
3037
## Contributing
3138
If you would like to contribute a patch to the code base, please read
3239
[these guidelines](CONTRIBUTING.md).

arch/x86/kvm/emulate.c

+26-11
Original file line numberDiff line numberDiff line change
@@ -836,18 +836,33 @@ static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt,
836836
}
837837

838838
/* Fetch next part of the instruction being emulated. */
839-
#define __insn_fetch_type(_type) \
840-
static __always_inline int \
841-
__insn_fetch_##_type(struct x86_emulate_ctxt *ctxt, _type *_x) \
842-
{ \
843-
int rc; \
844-
rc = do_insn_fetch_bytes(ctxt, sizeof(_type)); \
845-
if (rc == X86EMUL_CONTINUE) { \
839+
#define __insn_fetch_type(_type) \
840+
static __always_inline int \
841+
__insn_fetch_##_type(struct x86_emulate_ctxt *ctxt, void *_x, unsigned _x_size) \
842+
{ \
843+
int rc; \
844+
rc = do_insn_fetch_bytes(ctxt, sizeof(_type)); \
845+
if (rc == X86EMUL_CONTINUE) { \
846846
ctxt->_eip += sizeof(_type); \
847-
*_x = *(_type *) ctxt->fetch.ptr; \
847+
switch (_x_size) { \
848+
case 1: \
849+
*(u8 *)_x = *(_type *) ctxt->fetch.ptr; \
850+
break; \
851+
case 2: \
852+
*(u16 *)_x = *(_type *) ctxt->fetch.ptr;\
853+
break; \
854+
case 4: \
855+
*(u32 *)_x = *(_type *) ctxt->fetch.ptr;\
856+
break; \
857+
case 8: \
858+
*(u64 *)_x = *(_type *) ctxt->fetch.ptr;\
859+
break; \
860+
default: \
861+
BUG(); \
862+
} \
848863
ctxt->fetch.ptr += sizeof(_type); \
849-
} \
850-
return rc; \
864+
} \
865+
return rc; \
851866
}
852867

853868
__insn_fetch_type(u8)
@@ -859,7 +874,7 @@ __insn_fetch_type(s32)
859874
__insn_fetch_type(u64)
860875
__insn_fetch_type(s64)
861876

862-
#define insn_fetch(_type, _ctxt, _data) __insn_fetch_##_type(_ctxt, &(_type)_data)
877+
#define insn_fetch(_type, _ctxt, _data) __insn_fetch_##_type(_ctxt, (void *)&_data, sizeof(_data))
863878

864879
#define insn_fetch_modrmea(_type, _ctxt) \
865880
do { \

arch/x86/kvm/x86.c

+16-8
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,12 @@ static u32 msrs_to_save[] = {
734734

735735
static unsigned num_msrs_to_save;
736736

737+
static u32 emulated_msrs[] = {
738+
MSR_IA32_SMBASE,
739+
};
740+
741+
static unsigned num_emulated_msrs;
742+
737743
bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)
738744
{
739745
if (efer & efer_reserved_bits)
@@ -1348,7 +1354,7 @@ long kvm_arch_dev_ioctl(struct gvm_device_extension *devext,
13481354

13491355
r = STATUS_SUCCESS;
13501356
n = msr_list->nmsrs;
1351-
__u32 nmsrs = num_msrs_to_save;
1357+
__u32 nmsrs = num_msrs_to_save + num_emulated_msrs;
13521358
r = gvmUpdateReturnBuffer(pIrp, 0, &nmsrs, sizeof(nmsrs));
13531359
if (r)
13541360
goto out;
@@ -1360,6 +1366,9 @@ long kvm_arch_dev_ioctl(struct gvm_device_extension *devext,
13601366

13611367
r = gvmUpdateReturnBuffer(pIrp, sizeof(nmsrs), &msrs_to_save,
13621368
num_msrs_to_save * sizeof(u32));
1369+
1370+
r = gvmUpdateReturnBuffer(pIrp, sizeof(nmsrs) + sizeof(u32) * num_msrs_to_save,
1371+
&emulated_msrs, num_emulated_msrs * sizeof(u32));
13631372
break;
13641373
}
13651374
case GVM_GET_SUPPORTED_CPUID:
@@ -2381,7 +2390,6 @@ static void kvm_init_msr_list(void)
23812390
}
23822391
num_msrs_to_save = j;
23832392

2384-
#if 0
23852393
for (i = j = 0; i < ARRAY_SIZE(emulated_msrs); i++) {
23862394
switch (emulated_msrs[i]) {
23872395
case MSR_IA32_SMBASE:
@@ -2397,7 +2405,6 @@ static void kvm_init_msr_list(void)
23972405
j++;
23982406
}
23992407
num_emulated_msrs = j;
2400-
#endif
24012408
}
24022409

24032410
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)
47214728
vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
47224729

47234730
for (;;) {
4731+
if (test_and_clear_bit(0, (size_t *)&vcpu->run->user_event_pending)) {
4732+
r = 0;
4733+
vcpu->run->exit_reason = GVM_EXIT_INTR;
4734+
break;
4735+
}
4736+
47244737
if (kvm_vcpu_running(vcpu)) {
47254738
r = vcpu_enter_guest(vcpu);
47264739
} else {
@@ -4741,11 +4754,6 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
47414754
++vcpu->stat.request_irq_exits;
47424755
break;
47434756
}
4744-
if (test_and_clear_bit(0, (size_t *)&vcpu->run->user_event_pending)) {
4745-
r = 0;
4746-
vcpu->run->exit_reason = GVM_EXIT_INTR;
4747-
break;
4748-
}
47494757
}
47504758

47514759
srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);

gvm/gvm.vcxproj

+8
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
<PreBuildEvent>
105105
<Command>$(SolutionDir)\..\build\asmgen\x64\$(Configuration)\asmgen.exe &gt; $(ProjectDir)..\__asm.inc</Command>
106106
</PreBuildEvent>
107+
<DriverSign />
108+
<DriverSign>
109+
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
110+
</DriverSign>
107111
</ItemDefinitionGroup>
108112
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
109113
<ClCompile>
@@ -117,6 +121,10 @@
117121
<MASM>
118122
<IncludePaths>$(ProjectDir)..\;%(IncludePaths)</IncludePaths>
119123
</MASM>
124+
<DriverSign />
125+
<DriverSign>
126+
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
127+
</DriverSign>
120128
</ItemDefinitionGroup>
121129
<ItemGroup>
122130
<FilesToPackage Include="$(TargetPath)" />

gvm_ver.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define _XSTR(str) _STR(str)
1818

1919
#define GVM_MAJOR_VERSION 1
20-
#define GVM_MINOR_VERSION 7
20+
#define GVM_MINOR_VERSION 8
2121

2222
#define GVM_VERSION ((GVM_MAJOR_VERSION << 16) | GVM_MINOR_VERSION)
2323

ntkrutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode m
145145
KeInitializeTimerEx(&timer->ktimer, SynchronizationTimer);
146146
timer->base = &timer->base_hack;
147147
timer->base->get_time = ktime_get;
148-
KeInitializeDpc(&timer->kdpc, (PKDEFERRED_ROUTINE)timer_dpc_fn, timer);
148+
KeInitializeThreadedDpc(&timer->kdpc, (PKDEFERRED_ROUTINE)timer_dpc_fn, timer);
149149
}
150150

151151
int hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)

0 commit comments

Comments
 (0)