aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index da985b31b17e..8f1f07adb04e 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -253,6 +253,28 @@ int kvm_write_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size,
253} 253}
254EXPORT_SYMBOL_GPL(kvm_write_guest); 254EXPORT_SYMBOL_GPL(kvm_write_guest);
255 255
256void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
257{
258 if (!vcpu->fpu_active || vcpu->guest_fpu_loaded)
259 return;
260
261 vcpu->guest_fpu_loaded = 1;
262 fx_save(vcpu->host_fx_image);
263 fx_restore(vcpu->guest_fx_image);
264}
265EXPORT_SYMBOL_GPL(kvm_load_guest_fpu);
266
267void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
268{
269 if (!vcpu->guest_fpu_loaded)
270 return;
271
272 vcpu->guest_fpu_loaded = 0;
273 fx_save(vcpu->guest_fx_image);
274 fx_restore(vcpu->host_fx_image);
275}
276EXPORT_SYMBOL_GPL(kvm_put_guest_fpu);
277
256/* 278/*
257 * Switches to specified vcpu, until a matching vcpu_put() 279 * Switches to specified vcpu, until a matching vcpu_put()
258 */ 280 */