[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvm: Better gating of hvm_get_segment_register() in __hvm_copy().



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1203370017 0
# Node ID 8848d9e075848a09f130dc205298a8ce55809ef5
# Parent  9d29141a5e527d13c10b592c5b7807af73750a19
hvm: Better gating of hvm_get_segment_register() in __hvm_copy().
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff -r 9d29141a5e52 -r 8848d9e07584 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Mon Feb 18 13:50:25 2008 +0000
+++ b/xen/arch/x86/hvm/hvm.c    Mon Feb 18 21:26:57 2008 +0000
@@ -1393,20 +1393,18 @@ static enum hvm_copy_result __hvm_copy(
     int count, todo;
     uint32_t pfec = PFEC_page_present;
 
-    if ( virt )
-    {
-        /*
-         * We cannot use hvm_get_segment_register() while executing in
-         * vmx_realmode() as segment register state is cached. Furthermore,
-         * VMREADs on every data access hurts emulation performance.
-         */
-        if ( !curr->arch.hvm_vmx.vmxemul )
-        {
-            struct segment_register sreg;
-            hvm_get_segment_register(curr, x86_seg_ss, &sreg);
-            if ( sreg.attr.fields.dpl == 3 )
-                pfec |= PFEC_user_mode;
-        }
+    /*
+     * We cannot use hvm_get_segment_register() while executing in
+     * vmx_realmode() as segment register state is cached. Furthermore,
+     * VMREADs on every data access hurts emulation performance.
+     * Hence we do not gather extra PFEC flags if CR0.PG == 0.
+     */
+    if ( virt && (curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PG) )
+    {
+        struct segment_register sreg;
+        hvm_get_segment_register(curr, x86_seg_ss, &sreg);
+        if ( sreg.attr.fields.dpl == 3 )
+            pfec |= PFEC_user_mode;
 
         if ( dir ) 
             pfec |= PFEC_write_access;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.