[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [BUILDER] Always build initial PAE pagetables with a fourth mid-level
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |