]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Setup guest FPU state
authorPekka Enberg <penberg@cs.helsinki.fi>
Thu, 1 Apr 2010 13:35:38 +0000 (16:35 +0300)
committerPekka Enberg <penberg@cs.helsinki.fi>
Thu, 1 Apr 2010 13:36:01 +0000 (16:36 +0300)
Use the KVM_SET_FPU ioctl() to set up guest initial FPU state.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
tools/kvm/include/kvm/kvm.h
tools/kvm/kvm.c

index 73d3c857871a93fdc6c9b7d1636267d403f7ec87..f20988ac3e3e77164f678fff10397502fd8ee564 100644 (file)
@@ -25,6 +25,7 @@ struct kvm {
 
        struct kvm_regs         regs;
        struct kvm_sregs        sregs;
+       struct kvm_fpu          fpu;
 
        struct interrupt_table  interrupt_table;
 };
index 5c0089caa5331aa9169a344fc913f2aa34c84d63..6f43cd33171d8692613e535d7f751a25cbd84d6b 100644 (file)
@@ -405,6 +405,14 @@ void kvm__reset_vcpu(struct kvm *self)
        if (ioctl(self->vcpu_fd, KVM_SET_REGS, &self->regs) < 0)
                die_perror("KVM_SET_REGS failed");
 
+       self->fpu = (struct kvm_fpu) {
+               .fcw            = 0x37f,
+               .mxcsr          = 0x1f80,
+       };
+
+       if (ioctl(self->vcpu_fd, KVM_SET_FPU, &self->fpu) < 0)
+               die_perror("KVM_SET_FPU failed");
+
 }
 
 void kvm__run(struct kvm *self)