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] [BUILDER] Always build initial PAE pagetables with a fou

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [BUILDER] Always build initial PAE pagetables with a fourth mid-level
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 20 May 2006 16:42:10 +0000
Delivery-date: Sat, 20 May 2006 09:43:36 -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 d081a485f34bc074b56828e95b7c5a5c123c5c37
# Parent  ab27023d4c5b5746b3d65154f60a9c000fa8f42b
[BUILDER] Always build initial PAE pagetables with a fourth mid-level
pgdir. This is required for Xen to be able to insert its own protected
mappings. At the same time, clean up 32b and pae pagetable-size
calculations to use the helper macro already used for x86/64.

Based on an original patch from Bruce Rogers at Novell.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_linux_build.c |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 deletions(-)

diff -r ab27023d4c5b -r d081a485f34b tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Fri May 19 22:08:32 2006 +0100
+++ b/tools/libxc/xc_linux_build.c      Sat May 20 16:25:28 2006 +0100
@@ -327,6 +327,13 @@ static int setup_pg_tables_pae(int xc_ha
                 *vl1e &= ~_PAGE_RW;
         }
         vl1e++;
+    }
+
+    /* Xen requires a mid-level pgdir mapping 0xC0000000 region. */
+    if ( (vl3tab[3] & _PAGE_PRESENT) == 0 )
+    {
+        alloc_pt(l2tab, vl2tab, pl2tab);
+        vl3tab[3] = l2tab | L3_PROT;
     }
 
     munmap(vl1tab, PAGE_SIZE);
@@ -727,25 +734,28 @@ static int setup_guest(int xc_handle,
         v_end            = (vstack_end + (1UL<<22)-1) & ~((1UL<<22)-1);
         if ( (v_end - vstack_end) < (512UL << 10) )
             v_end += 1UL << 22; /* Add extra 4MB to get >= 512kB padding. */
-#if defined(__i386__)
-        if ( dsi.pae_kernel )
-        {
-            /* FIXME: assumes one L2 pgtable @ 0xc0000000 */
-            if ( (((v_end - dsi.v_start + ((1<<L2_PAGETABLE_SHIFT_PAE)-1)) >>
-                   L2_PAGETABLE_SHIFT_PAE) + 2) <= nr_pt_pages )
-                break;
-        }
-        else
-        {
-            if ( (((v_end - dsi.v_start + ((1<<L2_PAGETABLE_SHIFT)-1)) >>
-                   L2_PAGETABLE_SHIFT) + 1) <= nr_pt_pages )
-                break;
-        }
-#endif
-#if defined(__x86_64__)
 #define NR(_l,_h,_s) \
     (((((_h) + ((1UL<<(_s))-1)) & ~((1UL<<(_s))-1)) - \
     ((_l) & ~((1UL<<(_s))-1))) >> (_s))
+#if defined(__i386__)
+        if ( dsi.pae_kernel )
+        {
+            if ( (1 + /* # L3 */
+                  NR(dsi.v_start, v_end, L3_PAGETABLE_SHIFT_PAE) + /* # L2 */
+                  NR(dsi.v_start, v_end, L2_PAGETABLE_SHIFT_PAE) + /* # L1 */
+                  /* Include a fourth mid-level page directory for Xen. */
+                  (v_end <= (3 << L3_PAGETABLE_SHIFT_PAE)))
+                  <= nr_pt_pages )
+                break;
+        }
+        else
+        {
+            if ( (1 + /* # L2 */
+                  NR(dsi.v_start, v_end, L2_PAGETABLE_SHIFT)) /* # L1 */
+                 <= nr_pt_pages )
+                break;
+        }
+#elif defined(__x86_64__)
         if ( (1 + /* # L4 */
               NR(dsi.v_start, v_end, L4_PAGETABLE_SHIFT) + /* # L3 */
               NR(dsi.v_start, v_end, L3_PAGETABLE_SHIFT) + /* # L2 */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [BUILDER] Always build initial PAE pagetables with a fourth mid-level, Xen patchbot-unstable <=