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] Simplified vmx_platform.c by removing obsolete code and

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Simplified vmx_platform.c by removing obsolete code and redundant vmread's.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 03 Nov 2005 10:00:06 +0000
Delivery-date: Thu, 03 Nov 2005 09:57:42 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 289b73a5ace754043db86fa19585e770a0877a28
# Parent  ca2e91ab431167192e03ccd7248af40bc4d1a45b
Simplified vmx_platform.c by removing obsolete code and redundant vmread's.

Signed-Off-By: Leendert van Doorn <leendert@xxxxxxxxxxxxxx>

diff -r ca2e91ab4311 -r 289b73a5ace7 xen/arch/x86/vmx_platform.c
--- a/xen/arch/x86/vmx_platform.c       Thu Nov  3 01:45:07 2005
+++ b/xen/arch/x86/vmx_platform.c       Thu Nov  3 08:58:45 2005
@@ -366,20 +366,15 @@
     return DECODE_success;
 }
 
-static int vmx_decode(unsigned char *opcode, struct instruction *instr)
-{
-    unsigned long eflags;
-    int index, vm86 = 0;
+static int vmx_decode(int vm86, unsigned char *opcode, struct instruction 
*instr)
+{
+    unsigned char size_reg = 0;
     unsigned char rex = 0;
-    unsigned char size_reg = 0;
+    int index;
 
     init_instruction(instr);
 
     opcode = check_prefix(opcode, instr, &rex);
-
-    __vmread(GUEST_RFLAGS, &eflags);
-    if (eflags & X86_EFLAGS_VM)
-        vm86 = 1;
 
     if (vm86) { /* meaning is reversed */
         if (instr->op_size == WORD)
@@ -636,7 +631,6 @@
     struct vcpu *v = current;
     vcpu_iodata_t *vio;
     ioreq_t *p;
-    int vm86;
     struct cpu_user_regs *regs;
     extern long evtchn_send(int lport);
 
@@ -649,8 +643,6 @@
     }
 
     p = &vio->vp_ioreq;
-
-    vm86 = regs->eflags & X86_EFLAGS_VM;
 
     if (test_bit(ARCH_VMX_IO_WAIT, &v->arch.arch_vmx.flags)) {
         printf("VMX I/O has not yet completed\n");
@@ -725,7 +717,6 @@
 
 void handle_mmio(unsigned long va, unsigned long gpa)
 {
-    unsigned long eip, eflags, cs;
     unsigned long inst_len, inst_addr;
     struct mmio_op *mmio_opp;
     struct cpu_user_regs *regs;
@@ -734,18 +725,17 @@
     int i, vm86, ret;
 
     mmio_opp = &current->arch.arch_vmx.mmio_op;
+
     regs = mmio_opp->inst_decoder_regs;
-
-    __vmread(GUEST_RIP, &eip);
+    store_cpu_user_regs(regs);
+
     __vmread(VM_EXIT_INSTRUCTION_LEN, &inst_len);
-    __vmread(GUEST_RFLAGS, &eflags);
-    vm86 = eflags & X86_EFLAGS_VM;
-
-    if (vm86) {
-        __vmread(GUEST_CS_SELECTOR, &cs);
-        inst_addr = (cs << 4) + eip;
-    } else
-        inst_addr = eip;
+
+    vm86 = regs->eflags & X86_EFLAGS_VM;
+    if (vm86)
+        inst_addr = (regs->cs << 4) + regs->eip;
+    else
+        inst_addr = regs->eip;
 
     memset(inst, 0, MAX_INST_LEN);
     ret = inst_copy_from_guest(inst, inst_addr, inst_len);
@@ -756,7 +746,7 @@
 
     init_instruction(&mmio_inst);
 
-    if (vmx_decode(inst, &mmio_inst) == DECODE_failure) {
+    if (vmx_decode(vm86, inst, &mmio_inst) == DECODE_failure) {
         printf("mmio opcode: va 0x%lx, gpa 0x%lx, len %ld:",
                va, gpa, inst_len);
         for (i = 0; i < inst_len; i++)
@@ -765,7 +755,6 @@
         domain_crash_synchronous();
     }
 
-    store_cpu_user_regs(regs);
     regs->eip += inst_len; /* advance %eip */
 
     switch (mmio_inst.instr) {
@@ -783,16 +772,12 @@
 
         /* determine non-MMIO address */
         if (vm86) {
-            unsigned long seg;
-
-            __vmread(GUEST_ES_SELECTOR, &seg);
-            if (((seg << 4) + (regs->edi & 0xFFFF)) == va) {
+            if (((regs->es << 4) + (regs->edi & 0xFFFF)) == va) {
                 dir = IOREQ_WRITE;
-                __vmread(GUEST_DS_SELECTOR, &seg);
-                addr = (seg << 4) + (regs->esi & 0xFFFF);
+                addr = (regs->ds << 4) + (regs->esi & 0xFFFF);
             } else {
                 dir = IOREQ_READ;
-                addr = (seg << 4) + (regs->edi & 0xFFFF);
+                addr = (regs->es << 4) + (regs->edi & 0xFFFF);
             }
         } else {
             if (va == regs->edi) {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Simplified vmx_platform.c by removing obsolete code and redundant vmread's., Xen patchbot -unstable <=