x86/emul: Don't opencode CR0_TS in CLTS handling
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 19 Dec 2016 10:19:29 +0000 (10:19 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 20 Dec 2016 11:37:07 +0000 (11:37 +0000)
Also replace implicit 0 checks with X86EMUL_OKAY

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index be6904ff2ae083525f9c41e9dd768da5aab57475..34a511be0c5656ba5f901c97cd9df50e2b6741b9 100644 (file)
@@ -4703,8 +4703,8 @@ x86_emulate(
     case X86EMUL_OPC(0x0f, 0x06): /* clts */
         generate_exception_if(!mode_ring0(), EXC_GP, 0);
         fail_if((ops->read_cr == NULL) || (ops->write_cr == NULL));
-        if ( (rc = ops->read_cr(0, &dst.val, ctxt)) ||
-             (rc = ops->write_cr(0, dst.val&~8, ctxt)) )
+        if ( (rc = ops->read_cr(0, &dst.val, ctxt)) != X86EMUL_OKAY ||
+             (rc = ops->write_cr(0, dst.val & ~CR0_TS, ctxt)) != X86EMUL_OKAY )
             goto done;
         break;