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-devel

[Xen-devel] [PATCH] ptwr_emulate adjustments

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] ptwr_emulate adjustments
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Tue, 16 Jan 2007 12:40:57 +0000
Delivery-date: Tue, 16 Jan 2007 04:40:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
- really only do the invalid PAE PTE fixup on write to the high part
- dump guest execution state when emulation fails
- use the passed in register pointer rather than re-calculating
  guest_cpu_user_regs()

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2007-01-08/xen/arch/x86/mm.c
===================================================================
--- 2007-01-08.orig/xen/arch/x86/mm.c   2007-01-12 17:25:55.000000000 +0100
+++ 2007-01-08/xen/arch/x86/mm.c        2007-01-16 08:53:59.000000000 +0100
@@ -3237,22 +3237,25 @@ static int ptwr_emulated_update(
     {
         if ( (CONFIG_PAGING_LEVELS == 3 || IS_COMPAT(d)) &&
              (bytes == 4) &&
+             (addr & 4) &&
              !do_cmpxchg &&
              (l1e_get_flags(nl1e) & _PAGE_PRESENT) )
         {
             /*
-             * If this is a half-write to a PAE PTE then we assume that the
-             * guest has simply got the two writes the wrong way round. We
-             * zap the PRESENT bit on the assumption the bottom half will be
-             * written immediately after we return to the guest.
+             * If this is an upper half write to a PAE PTE then we assume
+             * that the guest has simply got the two writes the wrong way
+             * round. We zap the PRESENT bit on the assumption the bottom
+             * half will be written immediately after we return to the guest.
              */
             MEM_LOG("ptwr_emulate: fixing up invalid PAE PTE %"PRIpte,
                     l1e_get_intpte(nl1e));
+            show_execution_state(ptwr_ctxt->ctxt.regs);
             l1e_remove_flags(nl1e, _PAGE_PRESENT);
         }
         else
         {
             MEM_LOG("ptwr_emulate: could not get_page_from_l1e()");
+            show_execution_state(ptwr_ctxt->ctxt.regs);
             return X86EMUL_UNHANDLEABLE;
         }
     }
@@ -3375,7 +3378,8 @@ int ptwr_do_page_fault(struct vcpu *v, u
          (page_get_owner(page) != d) )
         goto bail;
 
-    ptwr_ctxt.ctxt.regs = guest_cpu_user_regs();
+    ASSERT(regs = guest_cpu_user_regs());
+    ptwr_ctxt.ctxt.regs = regs;
     ptwr_ctxt.ctxt.addr_size = ptwr_ctxt.ctxt.sp_size =
         IS_COMPAT(d) ? 32 : BITS_PER_LONG;
     ptwr_ctxt.cr2 = addr;


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

<Prev in Thread] Current Thread [Next in Thread>