summaryrefslogtreecommitdiff
path: root/kvm_x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'kvm_x86.c')
-rw-r--r--kvm_x86.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kvm_x86.c b/kvm_x86.c
index b83dbf0..010dfc2 100644
--- a/kvm_x86.c
+++ b/kvm_x86.c
@@ -652,13 +652,19 @@ do_set_msr(struct kvm_vcpu *vcpu, unsigned index, uint64_t *data)
static void
kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
{
- static int version;
+ int version;
struct pvclock_wall_clock wc;
struct timespec boot;
if (!wall_clock)
return;
+ if (kvm_read_guest(kvm, wall_clock, &version, sizeof (version)) != 0)
+ return;
+
+ if (version & 1)
+ version++; /* first time write, random junk */
+
version++;
kvm_write_guest(kvm, wall_clock, &version, sizeof (version));