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] SVM patch to reverse the logic of the general1 intercept

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] SVM patch to reverse the logic of the general1 intercepts for easier
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 18 May 2006 09:42:15 +0000
Delivery-date: Thu, 18 May 2006 02:44:23 -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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 3d85f350a66a006fd5df2c228cfd8b75e3240984
# Parent  632ad28f2fd7a6602b08a9d054dc1b44efaf93f3
SVM patch to reverse the logic of the general1 intercepts for easier
reading, also add the INVD intercept with print/eip increment only.

Signed-off-by: Tom Woller <thomas.woller@xxxxxxx>
Signed-off-by: Mats Petersson <mats.petersson@xxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c  |   32 +++++++++++++++++++++++++++-----
 xen/arch/x86/hvm/svm/vmcb.c |   16 ++++++----------
 2 files changed, 33 insertions(+), 15 deletions(-)

diff -r 632ad28f2fd7 -r 3d85f350a66a xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Wed May 17 23:50:23 2006 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Wed May 17 23:51:39 2006 +0100
@@ -1852,7 +1852,8 @@ static int svm_cr_access(struct vcpu *v,
         break;
 
     case INSTR_SMSW:
-        svm_dump_inst(svm_rip2pointer(vmcb));
+        if (svm_dbg_on)
+            svm_dump_inst(svm_rip2pointer(vmcb));
         value = v->arch.hvm_svm.cpu_shadow_cr0;
         gpreg = decode_src_reg(prefix, buffer[index+2]);
         set_reg(gpreg, value, regs, vmcb);
@@ -1989,9 +1990,25 @@ static inline void svm_vmexit_do_hlt(str
 }
 
 
-static inline void svm_vmexit_do_mwait(void)
-{
-}
+static void svm_vmexit_do_invd(struct vmcb_struct *vmcb)
+{
+    int  inst_len;
+    
+    /* Invalidate the cache - we can't really do that safely - maybe we should 
+     * WBINVD, but I think it's just fine to completely ignore it - we should 
+     * have cache-snooping that solves it anyways. -- Mats P. 
+     */
+
+    /* Tell the user that we did this - just in case someone runs some really 
weird 
+     * operating system and wants to know why it's not working as it should...
+     */
+    printk("INVD instruction intercepted - ignored\n");
+    
+    inst_len = __get_instruction_length(vmcb, INSTR_INVD, NULL);
+    __update_guest_eip(vmcb, inst_len);
+}    
+        
+
 
 
 #ifdef XEN_DEBUGGER
@@ -2053,7 +2070,7 @@ void svm_handle_invlpg(const short invlp
         __update_guest_eip(vmcb, inst_len);
 
         /* 
-         * The address is implicit on this instruction At the moment, we don't
+         * The address is implicit on this instruction. At the moment, we don't
          * use ecx (ASID) to identify individual guests pages 
          */
         g_vaddr = regs->eax;
@@ -2703,6 +2720,11 @@ asmlinkage void svm_vmexit_handler(struc
         raise_softirq(SCHEDULE_SOFTIRQ);
         break;
 
+
+    case VMEXIT_INVD:
+        svm_vmexit_do_invd(vmcb);
+        break;
+
     case VMEXIT_GDTR_WRITE:
         printk("WRITE to GDTR\n");
         break;
diff -r 632ad28f2fd7 -r 3d85f350a66a xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Wed May 17 23:50:23 2006 +0100
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Wed May 17 23:51:39 2006 +0100
@@ -117,16 +117,12 @@ static int construct_vmcb_controls(struc
 
     /* mask off all general 1 intercepts except those listed here */
     vmcb->general1_intercepts = 
-        ~(GENERAL1_INTERCEPT_CR0_SEL_WRITE | GENERAL1_INTERCEPT_VINTR      | 
-          GENERAL1_INTERCEPT_IDTR_READ     | GENERAL1_INTERCEPT_IDTR_WRITE | 
-          GENERAL1_INTERCEPT_GDTR_READ     | GENERAL1_INTERCEPT_GDTR_WRITE |
-          GENERAL1_INTERCEPT_LDTR_READ     | GENERAL1_INTERCEPT_LDTR_WRITE | 
-          GENERAL1_INTERCEPT_TR_READ       | GENERAL1_INTERCEPT_TR_WRITE   |
-          GENERAL1_INTERCEPT_RDTSC         | GENERAL1_INTERCEPT_PUSHF      |
-          GENERAL1_INTERCEPT_SWINT         | GENERAL1_INTERCEPT_POPF       | 
-          GENERAL1_INTERCEPT_IRET          | GENERAL1_INTERCEPT_PAUSE      |
-          GENERAL1_INTERCEPT_TASK_SWITCH
-        );
+        GENERAL1_INTERCEPT_INTR         | GENERAL1_INTERCEPT_NMI         |
+        GENERAL1_INTERCEPT_SMI          | GENERAL1_INTERCEPT_INIT        |
+        GENERAL1_INTERCEPT_CPUID        | GENERAL1_INTERCEPT_INVD        |
+        GENERAL1_INTERCEPT_HLT          | GENERAL1_INTERCEPT_INVLPG      | 
+        GENERAL1_INTERCEPT_INVLPGA      | GENERAL1_INTERCEPT_IOIO_PROT   |
+        GENERAL1_INTERCEPT_MSR_PROT     | GENERAL1_INTERCEPT_SHUTDOWN_EVT;
 
     /* turn on the general 2 intercepts */
     vmcb->general2_intercepts = 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] SVM patch to reverse the logic of the general1 intercepts for easier, Xen patchbot-unstable <=