diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-09-02 11:39:02 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-09-02 11:39:02 +0100 |
commit | b2af4890749e010602f1cbe3caabcfaa980cd4a8 (patch) | |
tree | a7e66d767727f2e39be45131396f11e15d8030a5 /xen/arch/x86/hvm/vpt.c | |
parent | 0bdd52018f654680965dbe4689328cb227e86bf4 (diff) | |
download | xen-b2af4890749e010602f1cbe3caabcfaa980cd4a8.tar.gz xen-b2af4890749e010602f1cbe3caabcfaa980cd4a8.tar.bz2 xen-b2af4890749e010602f1cbe3caabcfaa980cd4a8.zip |
x86: rdtsc emulation (PV and HVM) must be monotonically increasing
The Intel SDM (section 18.10) clearly states that rdtsc
returns a "monotonically increasing unique value".
Current emulation code for rdtsc (both PV and HVM) returns
only a monotonically-non-decreasing (non-unique) value,
so ensure stale value is always incremented.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Diffstat (limited to 'xen/arch/x86/hvm/vpt.c')
-rw-r--r-- | xen/arch/x86/hvm/vpt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index eb24f5d398..0cb180ceba 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -47,10 +47,10 @@ u64 hvm_get_guest_time(struct vcpu *v) spin_lock(&pl->pl_time_lock); now = get_s_time() + pl->stime_offset; - if ( (int64_t)(now - pl->last_guest_time) >= 0 ) + if ( (int64_t)(now - pl->last_guest_time) > 0 ) pl->last_guest_time = now; else - now = pl->last_guest_time; + now = ++pl->last_guest_time; spin_unlock(&pl->pl_time_lock); return now + v->arch.hvm_vcpu.stime_offset; |