[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Hand merge



ChangeSet 1.1339, 2005/04/20 13:32:43+01:00, mafetter@xxxxxxxxxxxxxxxx

        Hand merge
        
        Signed-off-by: michael.fetterman@xxxxxxxxxxxx



 arch/x86/domain.c             |    8 ++
 arch/x86/mm.c                 |   10 +-
 arch/x86/shadow.c             |    2 
 arch/x86/vmx.c                |    5 +
 arch/x86/x86_32/mm.c          |    6 -
 common/grant_table.c          |  148 +++++++++++++++++++++---------------------
 include/asm-x86/mm.h          |    2 
 include/asm-x86/x86_32/page.h |    2 
 8 files changed, 97 insertions(+), 86 deletions(-)


diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     2005-04-20 10:03:42 -04:00
+++ b/xen/arch/x86/domain.c     2005-04-20 10:03:42 -04:00
@@ -185,6 +185,14 @@
                    page->u.inuse.type_info);
         }
     }
+
+    list_for_each_entry ( page, &d->xenpage_list, list )
+    {
+        printk("XenPage %08x: caf=%08x, taf=%08x\n",
+               page_to_phys(page), page->count_info,
+               page->u.inuse.type_info);
+    }
+
     
     page = virt_to_page(d->shared_info);
     printk("Shared_info@%08x: caf=%08x, taf=%08x\n",
diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c 2005-04-20 10:03:42 -04:00
+++ b/xen/arch/x86/mm.c 2005-04-20 10:03:42 -04:00
@@ -1455,7 +1455,7 @@
         goto out;
     }
 
-    if ( unlikely(!array_access_ok(VERIFY_READ, uops, count, sizeof(op))) )
+    if ( unlikely(!array_access_ok(uops, count, sizeof(op))) )
     {
         rc = -EFAULT;
         goto out;
@@ -1625,7 +1625,6 @@
         {
             if ( shadow_mode_external(d) )
             {
-                // ignore this request from an external domain...
                 MEM_LOG("ignoring SET_LDT hypercall from external "
                         "domain %u\n", d->id);
                 okay = 0;
@@ -1636,8 +1635,7 @@
             unsigned long ents = op.nr_ents;
             if ( ((ptr & (PAGE_SIZE-1)) != 0) || 
                  (ents > 8192) ||
-                 ((ptr+ents*LDT_ENTRY_SIZE) < ptr) ||
-                 ((ptr+ents*LDT_ENTRY_SIZE) > PAGE_OFFSET) )
+                 !array_access_ok(ptr, ents, LDT_ENTRY_SIZE) )
             {
                 okay = 0;
                 MEM_LOG("Bad args to SET_LDT: ptr=%p, ents=%p", ptr, ents);
@@ -1812,7 +1810,7 @@
     perfc_addc(num_page_updates, count);
     perfc_incr_histo(bpt_updates, count, PT_UPDATES);
 
-    if ( unlikely(!array_access_ok(VERIFY_READ, ureqs, count, sizeof(req))) )
+    if ( unlikely(!array_access_ok(ureqs, count, sizeof(req))) )
     {
         rc = -EFAULT;
         goto out;
@@ -2589,7 +2587,7 @@
     struct domain *d = current->domain;
 
     /* Aligned access only, thank you. */
-    if ( !access_ok(VERIFY_WRITE, addr, bytes) || ((addr & (bytes-1)) != 0) )
+    if ( !access_ok(addr, bytes) || ((addr & (bytes-1)) != 0) )
     {
         MEM_LOG("ptwr_emulate: Unaligned or bad size ptwr access (%d, %p)\n",
                 bytes, addr);
diff -Nru a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c     2005-04-20 10:03:42 -04:00
+++ b/xen/arch/x86/shadow.c     2005-04-20 10:03:42 -04:00
@@ -1648,7 +1648,7 @@
 shadow_make_snapshot(
     struct domain *d, unsigned long gpfn, unsigned long gmfn)
 {
-    unsigned long smfn, sl1mfn;
+    unsigned long smfn, sl1mfn = 0;
     void *original, *snapshot;
     u32 min_max = 0;
     int min, max, length;
diff -Nru a/xen/arch/x86/vmx.c b/xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c        2005-04-20 10:03:42 -04:00
+++ b/xen/arch/x86/vmx.c        2005-04-20 10:03:42 -04:00
@@ -960,7 +960,12 @@
     struct exec_domain *d = current;
 
     local_irq_disable();        
+#ifdef __i386__
     asm volatile("movl %0,%%cr2": :"r" (d->arch.arch_vmx.cpu_cr2));
+#else
+    asm volatile("movq %0,%%cr2": :"r" (d->arch.arch_vmx.cpu_cr2));
+#endif
+
 }
 
 #endif /* CONFIG_VMX */
diff -Nru a/xen/arch/x86/x86_32/mm.c b/xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c  2005-04-20 10:03:42 -04:00
+++ b/xen/arch/x86/x86_32/mm.c  2005-04-20 10:03:42 -04:00
@@ -248,7 +248,7 @@
     
     /* Check that base is at least a page away from Xen-private area. */
     base  = (b&(0xff<<24)) | ((b&0xff)<<16) | (a>>16);
-    if ( base >= (PAGE_OFFSET - PAGE_SIZE) )
+    if ( base >= (GUEST_SEGMENT_MAX_ADDR - PAGE_SIZE) )
         goto bad;
 
     /* Check and truncate the limit if necessary. */
@@ -281,9 +281,9 @@
          *     limit == 0x00000 provides 4kB access (if G=1).
          */
         if ( ((base + limit) <= base) || 
-             ((base + limit) > PAGE_OFFSET) )
+             ((base + limit) > GUEST_SEGMENT_MAX_ADDR) )
         {
-            limit = PAGE_OFFSET - base;
+            limit = GUEST_SEGMENT_MAX_ADDR - base;
         truncate:
             if ( !(b & _SEGMENT_G) )
                 goto bad; /* too dangerous; too hard to work out... */
diff -Nru a/xen/common/grant_table.c b/xen/common/grant_table.c
--- a/xen/common/grant_table.c  2005-04-20 10:03:42 -04:00
+++ b/xen/common/grant_table.c  2005-04-20 10:03:42 -04:00
@@ -191,7 +191,8 @@
          * A more accurate check cannot be done with a single comparison.
          */
         if ( (act->pin & 0x80808080U) != 0 )
-            PIN_FAIL(unlock_out, ENOSPC, "Risk of counter overflow %08x\n", 
act->pin);
+            PIN_FAIL(unlock_out, ENOSPC,
+                     "Risk of counter overflow %08x\n", act->pin);
 
         frame = act->frame;
 
@@ -236,12 +237,14 @@
         if ( dev_hst_ro_flags & GNTMAP_device_map )
             act->pin += (dev_hst_ro_flags & GNTMAP_readonly) ? 
                 GNTPIN_devr_inc : GNTPIN_devw_inc;
+
         if ( dev_hst_ro_flags & GNTMAP_host_map )
             act->pin += (dev_hst_ro_flags & GNTMAP_readonly) ?
                 GNTPIN_hstr_inc : GNTPIN_hstw_inc;
     }
 
-    /* At this point:
+    /*
+     * At this point:
      * act->pin updated to reflect mapping.
      * sha->flags updated to indicate to granting domain mapping done.
      * frame contains the mfn.
@@ -251,28 +254,29 @@
 
     if ( (host_virt_addr != 0) && (dev_hst_ro_flags & GNTMAP_host_map) )
     {
-        /* Write update into the pagetable
-         */
+        /* Write update into the pagetable. */
         l1_pgentry_t pte;
-
         pte = l1e_create_pfn(frame, _PAGE_PRESENT | _PAGE_ACCESSED | 
_PAGE_DIRTY);
         if ( !(dev_hst_ro_flags & GNTMAP_readonly) )
             l1e_add_flags(&pte,_PAGE_RW);
         rc = update_grant_va_mapping( host_virt_addr, pte, 
                        mapping_d, mapping_ed );
 
-        /* IMPORTANT: (rc == 0) => must flush / invalidate entry in TLB.
+        /*
+         * IMPORTANT: (rc == 0) => must flush / invalidate entry in TLB.
          * This is done in the outer gnttab_map_grant_ref.
          */
 
-        if ( 0 > rc )
+        if ( rc < 0 )
         {
-            /* Abort. */
+            /* Failure: undo and abort. */
 
             spin_lock(&granting_d->grant_table->lock);
 
             if ( dev_hst_ro_flags & GNTMAP_readonly )
+            {
                 act->pin -= GNTPIN_hstr_inc;
+            }
             else
             {
                 act->pin -= GNTPIN_hstw_inc;
@@ -282,6 +286,7 @@
                     put_page_type(&frame_table[frame]);
                 }
             }
+
             if ( act->pin == 0 )
             {
                 clear_bit(_GTF_reading, &sha->flags);
@@ -292,6 +297,7 @@
         }
 
     }
+
     *pframe = frame;
     return rc;
 
@@ -300,6 +306,10 @@
     return rc;
 }
 
+/*
+ * Returns 0 if TLB flush / invalidate required by caller.
+ * va will indicate the address to be invalidated.
+ */
 static int
 __gnttab_map_grant_ref(
     gnttab_map_grant_ref_t *uop,
@@ -311,12 +321,9 @@
     struct exec_domain   *led;
     u16                   dev_hst_ro_flags;
     int                   handle;
-    unsigned long         frame, host_virt_addr;
+    unsigned long         frame = 0, host_virt_addr;
     int                   rc;
 
-    /* Returns 0 if TLB flush / invalidate required by caller.
-     * va will indicate the address to be invalidated. */
-
     led = current;
     ld = led->domain;
 
@@ -331,7 +338,7 @@
     }
 
 
-    if ( ((host_virt_addr != 0) || (dev_hst_ro_flags & GNTMAP_host_map) ) &&
+    if ( ((host_virt_addr != 0) || (dev_hst_ro_flags & GNTMAP_host_map)) &&
          unlikely(!__addr_ok(host_virt_addr)))
     {
         DPRINTK("Bad virtual address (%x) or flags (%x).\n",
@@ -341,8 +348,8 @@
     }
 
     if ( unlikely(ref >= NR_GRANT_ENTRIES) ||
-         unlikely((dev_hst_ro_flags & (GNTMAP_device_map|GNTMAP_host_map)) ==
-0) )
+         unlikely((dev_hst_ro_flags &
+                   (GNTMAP_device_map|GNTMAP_host_map)) == 0) )
     {
         DPRINTK("Bad ref (%d) or flags (%x).\n", ref, dev_hst_ro_flags);
         (void)__put_user(GNTST_bad_gntref, &uop->handle);
@@ -359,15 +366,16 @@
         return GNTST_bad_domain;
     }
 
-    /* get a maptrack handle */
+    /* Get a maptrack handle. */

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.