diff options
Diffstat (limited to 'arch/powerpc/kvm/emulate.c')
-rw-r--r-- | arch/powerpc/kvm/emulate.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c index 8f7a3aa03c26..141dce3c6810 100644 --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c | |||
@@ -114,6 +114,12 @@ void kvmppc_emulate_dec(struct kvm_vcpu *vcpu) | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb) | ||
118 | { | ||
119 | u64 jd = tb - vcpu->arch.dec_jiffies; | ||
120 | return vcpu->arch.dec - jd; | ||
121 | } | ||
122 | |||
117 | /* XXX to do: | 123 | /* XXX to do: |
118 | * lhax | 124 | * lhax |
119 | * lhaux | 125 | * lhaux |
@@ -279,11 +285,8 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) | |||
279 | 285 | ||
280 | case SPRN_DEC: | 286 | case SPRN_DEC: |
281 | { | 287 | { |
282 | u64 jd = get_tb() - vcpu->arch.dec_jiffies; | 288 | kvmppc_set_gpr(vcpu, rt, |
283 | kvmppc_set_gpr(vcpu, rt, vcpu->arch.dec - jd); | 289 | kvmppc_get_dec(vcpu, get_tb())); |
284 | pr_debug("mfDEC: %x - %llx = %lx\n", | ||
285 | vcpu->arch.dec, jd, | ||
286 | kvmppc_get_gpr(vcpu, rt)); | ||
287 | break; | 290 | break; |
288 | } | 291 | } |
289 | default: | 292 | default: |