WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Simplify vmx host state setup code.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Simplify vmx host state setup code.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Jul 2007 02:39:59 -0700
Delivery-date: Fri, 27 Jul 2007 02:38:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1184078744 -3600
# Node ID 1315b0901deaedcc375e1ec3cb97a67d7c1804be
# Parent  26eef84261106ee26e05cc3bb8dfb237b4915bd2
Simplify vmx host state setup code.
Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmcs.c |   58 ++++++++++++--------------------------------
 xen/include/asm-x86/desc.h  |    5 ---
 2 files changed, 16 insertions(+), 47 deletions(-)

diff -r 26eef8426110 -r 1315b0901dea xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Tue Jul 10 15:41:26 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Tue Jul 10 15:45:44 2007 +0100
@@ -247,55 +247,27 @@ void vmx_free_host_vmcs(struct vmcs_stru
     vmx_free_vmcs(vmcs);
 }
 
-#define GUEST_SEGMENT_LIMIT     0xffffffff
-
-struct host_execution_env {
-    /* selectors */
-    unsigned short ldtr_selector;
-    unsigned short tr_selector;
-    unsigned short ds_selector;
-    unsigned short cs_selector;
-    /* limits */
-    unsigned short gdtr_limit;
-    unsigned short ldtr_limit;
-    unsigned short idtr_limit;
-    unsigned short tr_limit;
-    /* base */
-    unsigned long gdtr_base;
-    unsigned long ldtr_base;
-    unsigned long idtr_base;
-    unsigned long tr_base;
-    unsigned long ds_base;
-    unsigned long cs_base;
-#ifdef __x86_64__
-    unsigned long fs_base;
-    unsigned long gs_base;
-#endif
+struct xgt_desc {
+    unsigned short size;
+    unsigned long address __attribute__((packed));
 };
 
 static void vmx_set_host_env(struct vcpu *v)
 {
     unsigned int tr, cpu;
-    struct host_execution_env host_env;
-    struct Xgt_desc_struct desc;
+    struct xgt_desc desc;
 
     cpu = smp_processor_id();
-    __asm__ __volatile__ ("sidt  (%0) \n" :: "a"(&desc) : "memory");
-    host_env.idtr_limit = desc.size;
-    host_env.idtr_base = desc.address;
-    __vmwrite(HOST_IDTR_BASE, host_env.idtr_base);
-
-    __asm__ __volatile__ ("sgdt  (%0) \n" :: "a"(&desc) : "memory");
-    host_env.gdtr_limit = desc.size;
-    host_env.gdtr_base = desc.address;
-    __vmwrite(HOST_GDTR_BASE, host_env.gdtr_base);
-
-    __asm__ __volatile__ ("str  (%0) \n" :: "a"(&tr) : "memory");
-    host_env.tr_selector = tr;
-    host_env.tr_limit = sizeof(struct tss_struct);
-    host_env.tr_base = (unsigned long) &init_tss[cpu];
-    __vmwrite(HOST_TR_SELECTOR, host_env.tr_selector);
-    __vmwrite(HOST_TR_BASE, host_env.tr_base);
+
+    __asm__ __volatile__ ( "sidt (%0) \n" : : "a" (&desc) : "memory" );
+    __vmwrite(HOST_IDTR_BASE, desc.address);
+
+    __asm__ __volatile__ ( "sgdt (%0) \n" : : "a" (&desc) : "memory" );
+    __vmwrite(HOST_GDTR_BASE, desc.address);
+
+    __asm__ __volatile__ ( "str (%0) \n" : : "a" (&tr) : "memory" );
+    __vmwrite(HOST_TR_SELECTOR, tr);
+    __vmwrite(HOST_TR_BASE, (unsigned long)&init_tss[cpu]);
 
     /*
      * Skip end of cpu_user_regs when entering the hypervisor because the
@@ -305,6 +277,8 @@ static void vmx_set_host_env(struct vcpu
     __vmwrite(HOST_RSP,
               (unsigned long)&get_cpu_info()->guest_cpu_user_regs.error_code);
 }
+
+#define GUEST_SEGMENT_LIMIT     0xffffffff
 
 static void construct_vmcs(struct vcpu *v)
 {
diff -r 26eef8426110 -r 1315b0901dea xen/include/asm-x86/desc.h
--- a/xen/include/asm-x86/desc.h        Tue Jul 10 15:41:26 2007 +0100
+++ b/xen/include/asm-x86/desc.h        Tue Jul 10 15:45:44 2007 +0100
@@ -203,11 +203,6 @@ extern struct desc_struct compat_gdt_tab
 # define compat_gdt_table gdt_table
 #endif
 
-struct Xgt_desc_struct {
-    unsigned short size;
-    unsigned long address __attribute__((packed));
-};
-
 extern void set_intr_gate(unsigned int irq, void * addr);
 extern void set_system_gate(unsigned int n, void *addr);
 extern void set_task_gate(unsigned int n, unsigned int sel);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Simplify vmx host state setup code., Xen patchbot-unstable <=