ia64/xen-unstable

changeset 17696:3ed3d0688fa8

x86: Remove 32-bit non-PAE code from dom0 builder, and avoid use of
get_page_type() on pagetable pages (pending support for preemptive
get_page_type(), as dom0 builder would be an awkward place to deal
with preemption).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 22 10:40:40 2008 +0100 (2008-05-22)
parents e64c3a8c60e1
children e48453f82d30
files xen/arch/x86/domain_build.c
line diff
     1.1 --- a/xen/arch/x86/domain_build.c	Wed May 21 16:55:11 2008 +0100
     1.2 +++ b/xen/arch/x86/domain_build.c	Thu May 22 10:40:40 2008 +0100
     1.3 @@ -221,9 +221,7 @@ int __init construct_dom0(
     1.4  #if CONFIG_PAGING_LEVELS >= 4
     1.5      l4_pgentry_t *l4tab = NULL, *l4start = NULL;
     1.6  #endif
     1.7 -#if CONFIG_PAGING_LEVELS >= 3
     1.8      l3_pgentry_t *l3tab = NULL, *l3start = NULL;
     1.9 -#endif
    1.10      l2_pgentry_t *l2tab = NULL, *l2start = NULL;
    1.11      l1_pgentry_t *l1tab = NULL, *l1start = NULL;
    1.12  
    1.13 @@ -277,13 +275,6 @@ int __init construct_dom0(
    1.14      compat32   = 0;
    1.15      machine = elf_uval(&elf, elf.ehdr, e_machine);
    1.16      switch (CONFIG_PAGING_LEVELS) {
    1.17 -    case 2: /* x86_32 */
    1.18 -        if (parms.pae == PAEKERN_bimodal)
    1.19 -            parms.pae = PAEKERN_no;
    1.20 -        printk(" Xen  kernel: 32-bit, lsb\n");
    1.21 -        if (elf_32bit(&elf) && !parms.pae && machine == EM_386)
    1.22 -            compatible = 1;
    1.23 -        break;
    1.24      case 3: /* x86_32p */
    1.25          if (parms.pae == PAEKERN_bimodal)
    1.26              parms.pae = PAEKERN_extended_cr3;
    1.27 @@ -479,7 +470,6 @@ int __init construct_dom0(
    1.28      }
    1.29  
    1.30      /* WARNING: The new domain must have its 'processor' field filled in! */
    1.31 -#if CONFIG_PAGING_LEVELS == 3
    1.32      l3start = l3tab = (l3_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE;
    1.33      l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += 4*PAGE_SIZE;
    1.34      memcpy(l2tab, idle_pg_table_l2, 4*PAGE_SIZE);
    1.35 @@ -489,13 +479,6 @@ int __init construct_dom0(
    1.36              l2e_from_paddr((u32)l2tab + i*PAGE_SIZE, __PAGE_HYPERVISOR);
    1.37      }
    1.38      v->arch.guest_table = pagetable_from_paddr((unsigned long)l3start);
    1.39 -#else
    1.40 -    l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE;
    1.41 -    copy_page(l2tab, idle_pg_table);
    1.42 -    l2tab[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] =
    1.43 -        l2e_from_paddr((unsigned long)l2start, __PAGE_HYPERVISOR);
    1.44 -    v->arch.guest_table = pagetable_from_paddr((unsigned long)l2start);
    1.45 -#endif
    1.46  
    1.47      for ( i = 0; i < PDPT_L2_ENTRIES; i++ )
    1.48          l2tab[l2_linear_offset(PERDOMAIN_VIRT_START) + i] =
    1.49 @@ -539,16 +522,16 @@ int __init construct_dom0(
    1.50              if ( !get_page_type(page, PGT_writable_page) )
    1.51                  BUG();
    1.52  
    1.53 -#if CONFIG_PAGING_LEVELS == 3
    1.54 -        switch (count) {
    1.55 +        switch ( count )
    1.56 +        {
    1.57          case 0:
    1.58              page->u.inuse.type_info &= ~PGT_type_mask;
    1.59              page->u.inuse.type_info |= PGT_l3_page_table;
    1.60              get_page(page, d); /* an extra ref because of readable mapping */
    1.61  
    1.62              /* Get another ref to L3 page so that it can be pinned. */
    1.63 -            if ( !get_page_and_type(page, d, PGT_l3_page_table) )
    1.64 -                BUG();
    1.65 +            page->u.inuse.type_info++;
    1.66 +            page->count_info++;
    1.67              set_bit(_PGT_pinned, &page->u.inuse.type_info);
    1.68              break;
    1.69          case 1 ... 4:
    1.70 @@ -564,38 +547,6 @@ int __init construct_dom0(
    1.71              get_page(page, d); /* an extra ref because of readable mapping */
    1.72              break;
    1.73          }
    1.74 -#else
    1.75 -        if ( count == 0 )
    1.76 -        {
    1.77 -            page->u.inuse.type_info &= ~PGT_type_mask;
    1.78 -            page->u.inuse.type_info |= PGT_l2_page_table;
    1.79 -
    1.80 -            /*
    1.81 -             * No longer writable: decrement the type_count.
    1.82 -             * Installed as CR3: increment both the ref_count and type_count.
    1.83 -             * Net: just increment the ref_count.
    1.84 -             */
    1.85 -            get_page(page, d); /* an extra ref because of readable mapping */
    1.86 -
    1.87 -            /* Get another ref to L2 page so that it can be pinned. */
    1.88 -            if ( !get_page_and_type(page, d, PGT_l2_page_table) )
    1.89 -                BUG();
    1.90 -            set_bit(_PGT_pinned, &page->u.inuse.type_info);
    1.91 -        }
    1.92 -        else
    1.93 -        {
    1.94 -            page->u.inuse.type_info &= ~PGT_type_mask;
    1.95 -            page->u.inuse.type_info |= PGT_l1_page_table;
    1.96 -
    1.97 -            /*
    1.98 -             * No longer writable: decrement the type_count.
    1.99 -             * This is an L1 page, installed in a validated L2 page:
   1.100 -             * increment both the ref_count and type_count.
   1.101 -             * Net: just increment the ref_count.
   1.102 -             */
   1.103 -            get_page(page, d); /* an extra ref because of readable mapping */
   1.104 -        }
   1.105 -#endif
   1.106          if ( !((unsigned long)++l1tab & (PAGE_SIZE - 1)) )
   1.107              l1start = l1tab = (l1_pgentry_t *)(u32)l2e_get_paddr(*++l2tab);
   1.108      }