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] Currently if one tries to execute VMX instruction from i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Currently if one tries to execute VMX instruction from inside the
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 11 Mar 2006 11:56:07 +0000
Delivery-date: Sat, 11 Mar 2006 11:56:59 +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 3f8123ae34bab8e9068de1d97686b2a7a4608f3f
# Parent  a5a50f6fbc0982aa256c8fc29bbdfe88e14abc6f
 Currently if one tries to execute VMX instruction from inside the
VMX guest, the Xen hyper visor has no handling of it resulting in a
bug(). This patch handles such VMX instructions from the guest returning
invalid opcode to the guest. Also the macro VMX_INVALID_ERROR_CODE is
renamed to the more meaningful VMX_DELIVER_NO_ERROR_CODE.

Signed-Off-By: Nitin A Kamble <nitin.a.kamble@xxxxxxxxx>
Signed-Off-By: Jun Nakajima <jun.nakajima@xxxxxxxxx>=20

diff -r a5a50f6fbc09 -r 3f8123ae34ba xen/arch/x86/hvm/svm/intr.c
--- a/xen/arch/x86/hvm/svm/intr.c       Sat Mar 11 09:44:48 2006
+++ b/xen/arch/x86/hvm/svm/intr.c       Sat Mar 11 09:47:55 2006
@@ -187,7 +187,7 @@
             }
             /* let's inject this interrupt */
             TRACE_3D(TRC_VMX_INT, v->domain->domain_id, intr_vector, 0);
-            svm_inject_extint(v, intr_vector, VMX_INVALID_ERROR_CODE);
+            svm_inject_extint(v, intr_vector, VMX_DELIVER_NO_ERROR_CODE);
             interrupt_post_injection(v, intr_vector, intr_type);
             break;
         case VLAPIC_DELIV_MODE_SMI:
diff -r a5a50f6fbc09 -r 3f8123ae34ba xen/arch/x86/hvm/vmx/io.c
--- a/xen/arch/x86/hvm/vmx/io.c Sat Mar 11 09:44:48 2006
+++ b/xen/arch/x86/hvm/vmx/io.c Sat Mar 11 09:47:55 2006
@@ -165,7 +165,7 @@
     case VLAPIC_DELIV_MODE_EXT:
     case VLAPIC_DELIV_MODE_FIXED:
     case VLAPIC_DELIV_MODE_LPRI:
-        vmx_inject_extint(v, highest_vector, VMX_INVALID_ERROR_CODE);
+        vmx_inject_extint(v, highest_vector, VMX_DELIVER_NO_ERROR_CODE);
         TRACE_3D(TRC_VMX_INT, v->domain->domain_id, highest_vector, 0);
         break;
     case VLAPIC_DELIV_MODE_SMI:
diff -r a5a50f6fbc09 -r 3f8123ae34ba xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Sat Mar 11 09:44:48 2006
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Sat Mar 11 09:47:55 2006
@@ -1917,7 +1917,7 @@
     /* don't bother H/W interrutps */
     if (exit_reason != EXIT_REASON_EXTERNAL_INTERRUPT &&
         exit_reason != EXIT_REASON_VMCALL &&
-        exit_reason != EXIT_REASON_IO_INSTRUCTION)
+        exit_reason != EXIT_REASON_IO_INSTRUCTION) 
         HVM_DBG_LOG(DBG_LEVEL_0, "exit reason = %x", exit_reason);
 
     if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) {
@@ -2052,6 +2052,7 @@
         __update_guest_eip(inst_len);
         break;
     }
+#if 0 /* keep this for debugging */
     case EXIT_REASON_VMCALL:
         __get_instruction_length(inst_len);
         __vmread(GUEST_RIP, &eip);
@@ -2060,6 +2061,7 @@
         hvm_print_line(v, regs.eax); /* provides the current domain */
         __update_guest_eip(inst_len);
         break;
+#endif
     case EXIT_REASON_CR_ACCESS:
     {
         __vmread(GUEST_RIP, &eip);
@@ -2100,6 +2102,21 @@
     case EXIT_REASON_MWAIT_INSTRUCTION:
         __hvm_bug(&regs);
         break;
+    case EXIT_REASON_VMCALL:
+    case EXIT_REASON_VMCLEAR:
+    case EXIT_REASON_VMLAUNCH:
+    case EXIT_REASON_VMPTRLD:
+    case EXIT_REASON_VMPTRST:
+    case EXIT_REASON_VMREAD:
+    case EXIT_REASON_VMRESUME:
+    case EXIT_REASON_VMWRITE:
+    case EXIT_REASON_VMOFF:
+    case EXIT_REASON_VMON:
+        /* Report invalid opcode exception when a VMX guest tries to execute 
+            any of the VMX instructions */
+        vmx_inject_exception(v, TRAP_invalid_op, VMX_DELIVER_NO_ERROR_CODE);
+        break;
+
     default:
         __hvm_bug(&regs);       /* should not happen */
     }
diff -r a5a50f6fbc09 -r 3f8123ae34ba xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h Sat Mar 11 09:44:48 2006
+++ b/xen/include/asm-x86/hvm/support.h Sat Mar 11 09:47:55 2006
@@ -99,7 +99,7 @@
 
 #define PC_DEBUG_PORT   0x80
 
-#define VMX_INVALID_ERROR_CODE  -1
+#define VMX_DELIVER_NO_ERROR_CODE  -1
 
 /*
  * This works for both 32bit & 64bit eflags filteration
diff -r a5a50f6fbc09 -r 3f8123ae34ba xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Sat Mar 11 09:44:48 2006
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Sat Mar 11 09:47:55 2006
@@ -119,7 +119,15 @@
 #define EXIT_REASON_RDPMC               15
 #define EXIT_REASON_RDTSC               16
 #define EXIT_REASON_VMCALL              18
-
+#define EXIT_REASON_VMCLEAR             19
+#define EXIT_REASON_VMLAUNCH            20
+#define EXIT_REASON_VMPTRLD             21
+#define EXIT_REASON_VMPTRST             22
+#define EXIT_REASON_VMREAD              23
+#define EXIT_REASON_VMRESUME            24
+#define EXIT_REASON_VMWRITE             25
+#define EXIT_REASON_VMOFF               26
+#define EXIT_REASON_VMON                27
 #define EXIT_REASON_CR_ACCESS           28
 #define EXIT_REASON_DR_ACCESS           29
 #define EXIT_REASON_IO_INSTRUCTION      30
@@ -425,7 +433,7 @@
 
     /* Reflect it back into the guest */
     intr_fields = (INTR_INFO_VALID_MASK | type | trap);
-    if (error_code != VMX_INVALID_ERROR_CODE) {
+    if (error_code != VMX_DELIVER_NO_ERROR_CODE) {
         __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
         intr_fields |= INTR_INFO_DELIEVER_CODE_MASK;
      }
@@ -455,7 +463,7 @@
     if (vector & INTR_INFO_DELIEVER_CODE_MASK)
         __vmread(VM_EXIT_INTR_ERROR_CODE, &error_code);
     else
-        error_code = VMX_INVALID_ERROR_CODE;
+        error_code = VMX_DELIVER_NO_ERROR_CODE;
     vector &= 0xff;
 
 #ifndef NDEBUG

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Currently if one tries to execute VMX instruction from inside the, Xen patchbot -unstable <=