ia64/xen-unstable

changeset 11467:7474bb5e2923

[XEN][X86_64] Allocate multiple L2 page directories for
the read-only M2P table mapping, if required.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 13 14:30:06 2006 +0100 (2006-09-13)
parents 29bc328cd8d3
children 3bff5c5b9206
files xen/arch/x86/x86_64/mm.c
line diff
     1.1 --- a/xen/arch/x86/x86_64/mm.c	Wed Sep 13 14:24:42 2006 +0100
     1.2 +++ b/xen/arch/x86/x86_64/mm.c	Wed Sep 13 14:30:06 2006 +0100
     1.3 @@ -78,7 +78,7 @@ void __init paging_init(void)
     1.4  {
     1.5      unsigned long i, mpt_size;
     1.6      l3_pgentry_t *l3_ro_mpt;
     1.7 -    l2_pgentry_t *l2_ro_mpt;
     1.8 +    l2_pgentry_t *l2_ro_mpt = NULL;
     1.9      struct page_info *pg;
    1.10  
    1.11      /* Create user-accessible L2 directory to map the MPT for guests. */
    1.12 @@ -87,12 +87,6 @@ void __init paging_init(void)
    1.13      idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)] =
    1.14          l4e_from_page(
    1.15              virt_to_page(l3_ro_mpt), __PAGE_HYPERVISOR | _PAGE_USER);
    1.16 -    l2_ro_mpt = alloc_xenheap_page();
    1.17 -    clear_page(l2_ro_mpt);
    1.18 -    l3_ro_mpt[l3_table_offset(RO_MPT_VIRT_START)] =
    1.19 -        l3e_from_page(
    1.20 -            virt_to_page(l2_ro_mpt), __PAGE_HYPERVISOR | _PAGE_USER);
    1.21 -    l2_ro_mpt += l2_table_offset(RO_MPT_VIRT_START);
    1.22  
    1.23      /*
    1.24       * Allocate and map the machine-to-phys table.
    1.25 @@ -110,10 +104,20 @@ void __init paging_init(void)
    1.26              PAGE_HYPERVISOR);
    1.27          memset((void *)(RDWR_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT)), 0x55,
    1.28                 1UL << L2_PAGETABLE_SHIFT);
    1.29 +        if ( !((unsigned long)l2_ro_mpt & ~PAGE_MASK) )
    1.30 +        {
    1.31 +            unsigned long va = RO_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT);
    1.32 +
    1.33 +            l2_ro_mpt = alloc_xenheap_page();
    1.34 +            clear_page(l2_ro_mpt);
    1.35 +            l3_ro_mpt[l3_table_offset(va)] =
    1.36 +                l3e_from_page(
    1.37 +                    virt_to_page(l2_ro_mpt), __PAGE_HYPERVISOR | _PAGE_USER);
    1.38 +            l2_ro_mpt += l2_table_offset(va);
    1.39 +        }
    1.40          /* NB. Cannot be GLOBAL as shadow_mode_translate reuses this area. */
    1.41          *l2_ro_mpt++ = l2e_from_page(
    1.42              pg, /*_PAGE_GLOBAL|*/_PAGE_PSE|_PAGE_USER|_PAGE_PRESENT);
    1.43 -        BUG_ON(((unsigned long)l2_ro_mpt & ~PAGE_MASK) == 0);
    1.44      }
    1.45  
    1.46      /* Set up linear page table mapping. */