]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
x86/HVM: account for fully eager FPU mode in emulation
authorJan Beulich <jbeulich@suse.com>
Fri, 15 Jun 2018 09:49:06 +0000 (11:49 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 15 Jun 2018 09:49:06 +0000 (11:49 +0200)
In fully eager mode we must not clear fpu_dirtied, set CR0.TS, or invoke
the fpu_leave() hook. Instead do what the mode's name says: Restore
state right away.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/hvm/emulate.c

index c9aa18884dae7514af06517a9a51ab319a3b7fc7..03a4944e880c6e6643246f26598c76cc56e107d5 100644 (file)
@@ -2139,13 +2139,20 @@ static void hvmemul_put_fpu(
     if ( backout == X86EMUL_FPU_fpu )
     {
         /*
-         * To back out changes to the register file simply adjust state such
-         * that upon next FPU insn use by the guest we'll reload the state
-         * saved (or freshly loaded) by hvmemul_get_fpu().
+         * To back out changes to the register file
+         * - in fully eager mode, restore original state immediately,
+         * - in lazy mode, simply adjust state such that upon next FPU insn
+         *   use by the guest we'll reload the state saved (or freshly loaded)
+         *   by hvmemul_get_fpu().
          */
-        curr->fpu_dirtied = false;
-        stts();
-        hvm_funcs.fpu_leave(curr);
+        if ( curr->arch.fully_eager_fpu )
+            vcpu_restore_fpu_eager(curr);
+        else
+        {
+            curr->fpu_dirtied = false;
+            stts();
+            hvm_funcs.fpu_leave(curr);
+        }
     }
 }