summaryrefslogtreecommitdiff
path: root/kvm_x86.c
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2011-05-05 17:44:49 -0700
committerBryan Cantrill <bryan@joyent.com>2011-05-05 17:44:49 -0700
commit7b892c19bc544af610d126d1d25b218220ac396e (patch)
tree1ad740ba132fcfd9ba03205707f620ff6b0cf778 /kvm_x86.c
parentd02410213c9a8a8f5e8d6dbad72aacffbe70dad7 (diff)
downloadillumos-kvm-7b892c19bc544af610d126d1d25b218220ac396e.tar.gz
HVM-164 apic_get_tmcct() confuses remaining with elapsed
Diffstat (limited to 'kvm_x86.c')
-rw-r--r--kvm_x86.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kvm_x86.c b/kvm_x86.c
index aae4904..d0f5891 100644
--- a/kvm_x86.c
+++ b/kvm_x86.c
@@ -641,7 +641,7 @@ apic_x2apic_mode(struct kvm_lapic *apic)
static uint32_t
apic_get_tmcct(struct kvm_lapic *apic)
{
- hrtime_t now, remaining;
+ hrtime_t now, remaining, elapsed;
uint32_t tmcct;
VERIFY(apic != NULL);
@@ -651,8 +651,9 @@ apic_get_tmcct(struct kvm_lapic *apic)
return (0);
now = gethrtime();
- remaining = now - apic->lapic_timer.start -
+ elapsed = now - apic->lapic_timer.start -
apic->lapic_timer.period * apic->lapic_timer.intervals;
+ remaining = apic->lapic_timer.period - elapsed;
if (remaining < 0)
remaining = 0;