All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ling, Xiaofeng" <xiaofeng.ling@intel.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH]fix clts issue for vmx guest
Date: Wed, 14 Dec 2005 17:20:58 +0800	[thread overview]
Message-ID: <439FE3FA.7000203@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

# HG changeset patch
# User Xiaofeng Ling <xiaofeng.ling@intel.com>
# Node ID c137bd19e407f249d22784884e6a8f31154bee82
# Parent  179f7d89d368511f6eaaf870fcc580c02c838916
Fix the issue when guest OS clear TS bit by mov to cr0 instead of
clts instruction for floating point context save and restore.
clts instruction is already handled in vmx exit handler while
vmx_set_cr0 has not handled it yet.

[-- Attachment #2: cltsfix.patch --]
[-- Type: text/x-patch, Size: 1279 bytes --]

# HG changeset patch
# User Xiaofeng Ling <xiaofeng.ling@intel.com>
# Node ID c137bd19e407f249d22784884e6a8f31154bee82
# Parent  179f7d89d368511f6eaaf870fcc580c02c838916
Fix the issue when guest OS clear TS bit by mov to cr0 instead of 
clts instruction for floating point context save and restore.
clts instruction is already handled in vmx exit handler while 
vmx_set_cr0 has not handled it yet.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>

diff -r 179f7d89d368 -r c137bd19e407 xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c	Wed Dec 14 12:45:26 2005 +0800
+++ b/xen/arch/x86/vmx.c	Wed Dec 14 13:06:39 2005 +0800
@@ -1109,11 +1109,21 @@
     unsigned long eip;
     int paging_enabled;
     unsigned long vm_entry_value;
+    unsigned long old_cr0;
 
     /*
      * CR0: We don't want to lose PE and PG.
      */
-    paging_enabled = vmx_paging_enabled(v);
+    __vmread_vcpu(v, CR0_READ_SHADOW, &old_cr0);
+    paging_enabled = (old_cr0 & X86_CR0_PE) && (old_cr0 & X86_CR0_PG);
+    /* If OS don't use clts to clear TS bit...*/
+    if((old_cr0 & X86_CR0_TS) && !(value & X86_CR0_TS))
+    {
+            clts();
+            setup_fpu(v);
+    }
+
+
     __vmwrite(GUEST_CR0, value | X86_CR0_PE | X86_CR0_PG | X86_CR0_NE);
     __vmwrite(CR0_READ_SHADOW, value);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2005-12-14  9:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=439FE3FA.7000203@intel.com \
    --to=xiaofeng.ling@intel.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.