ia64/xen-unstable

changeset 3891:bedb2b313393

bitkeeper revision 1.1234 (421b3fb4-44X_GoE5Kjk9WGfmRE_rg)

Move the phys-to-mach map from PERDOMAIN_VIRT_START to
RO_MPT_VIRT_START (which isn't otherwise used by
shadow_mode_shadow()==true domains).

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author maf46@burn.cl.cam.ac.uk
date Tue Feb 22 14:20:36 2005 +0000 (2005-02-22)
parents a42fd001d8f5
children ff8c9a2be5f7
files xen/arch/x86/domain.c xen/arch/x86/x86_32/mm.c xen/include/asm-x86/mm.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Mon Feb 21 17:36:54 2005 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Tue Feb 22 14:20:36 2005 +0000
     1.3 @@ -299,7 +299,7 @@ void arch_vmx_do_launch(struct exec_doma
     1.4  static void alloc_monitor_pagetable(struct exec_domain *ed)
     1.5  {
     1.6      unsigned long mmfn;
     1.7 -    l2_pgentry_t *mpl2e, *phys_table;
     1.8 +    l2_pgentry_t *mpl2e;
     1.9      struct pfn_info *mmfn_info;
    1.10      struct domain *d = ed->domain;
    1.11  
    1.12 @@ -323,12 +323,9 @@ static void alloc_monitor_pagetable(stru
    1.13      ed->arch.monitor_table = mk_pagetable(mmfn << PAGE_SHIFT);
    1.14      ed->arch.monitor_vtable = mpl2e;
    1.15  
    1.16 -    phys_table = (l2_pgentry_t *)
    1.17 -        map_domain_mem(pagetable_val(ed->arch.phys_table));
    1.18 -    memcpy(d->arch.mm_perdomain_pt, phys_table,
    1.19 -           L1_PAGETABLE_ENTRIES * sizeof(l1_pgentry_t));
    1.20 -
    1.21 -    unmap_domain_mem(phys_table);
    1.22 +    // map the phys_to_machine map into the Read-Only MPT space for this domain
    1.23 +    mpl2e[l2_table_offset(RO_MPT_VIRT_START)] =
    1.24 +        mk_l2_pgentry(pagetable_val(ed->arch.phys_table) | __PAGE_HYPERVISOR);
    1.25  }
    1.26  
    1.27  /*
     2.1 --- a/xen/arch/x86/x86_32/mm.c	Mon Feb 21 17:36:54 2005 +0000
     2.2 +++ b/xen/arch/x86/x86_32/mm.c	Tue Feb 22 14:20:36 2005 +0000
     2.3 @@ -119,10 +119,14 @@ void __init paging_init(void)
     2.4      idle_pg_table[l2_table_offset(IOREMAP_VIRT_START)] =
     2.5          mk_l2_pgentry(__pa(ioremap_pt) | __PAGE_HYPERVISOR);
     2.6  
     2.7 -    /* Create read-only mapping of MPT for guest-OS use. */
     2.8 +    /* Create read-only mapping of MPT for guest-OS use.
     2.9 +     * NB. Remove the global bit so that shadow_mode_translate()==true domains
    2.10 +     *     can reused this address space for their phys-to-machine mapping.
    2.11 +     */
    2.12      idle_pg_table[l2_table_offset(RO_MPT_VIRT_START)] =
    2.13          mk_l2_pgentry(l2_pgentry_val(
    2.14 -            idle_pg_table[l2_table_offset(RDWR_MPT_VIRT_START)]) & ~_PAGE_RW);
    2.15 +                          idle_pg_table[l2_table_offset(RDWR_MPT_VIRT_START)]) &
    2.16 +                      ~(_PAGE_RW | _PAGE_GLOBAL));
    2.17  
    2.18      /* Set up mapping cache for domain pages. */
    2.19      mapcache = (unsigned long *)alloc_xenheap_page();
     3.1 --- a/xen/include/asm-x86/mm.h	Mon Feb 21 17:36:54 2005 +0000
     3.2 +++ b/xen/include/asm-x86/mm.h	Tue Feb 22 14:20:36 2005 +0000
     3.3 @@ -235,9 +235,11 @@ void synchronise_pagetables(unsigned lon
     3.4  
     3.5  /*
     3.6   * The phys_to_machine_mapping is the reversed mapping of MPT for full
     3.7 - * virtualization.
     3.8 + * virtualization.  It is only used by shadow_mode_translate()==true
     3.9 + * guests, so we steal the address space that would have normally
    3.10 + * been used by the read-only MPT map.
    3.11   */
    3.12 -#define __phys_to_machine_mapping ((unsigned long *)PERDOMAIN_VIRT_START)
    3.13 +#define __phys_to_machine_mapping ((unsigned long *)RO_MPT_VIRT_START)
    3.14  
    3.15  /* Returns the machine physical */
    3.16  static inline unsigned long phys_to_machine_mapping(unsigned long pfn) 
    3.17 @@ -245,11 +247,11 @@ static inline unsigned long phys_to_mach
    3.18      unsigned long mfn;
    3.19      l1_pgentry_t pte;
    3.20  
    3.21 -   if (__get_user(l1_pgentry_val(pte), (__phys_to_machine_mapping + pfn))) {
    3.22 -       return 0;
    3.23 -   }
    3.24 -               
    3.25 -   mfn = l1_pgentry_to_phys(pte) >> PAGE_SHIFT;
    3.26 +   if (__get_user(l1_pgentry_val(pte), (__phys_to_machine_mapping + pfn)))
    3.27 +       mfn = 0;
    3.28 +   else
    3.29 +       mfn = l1_pgentry_to_phys(pte) >> PAGE_SHIFT;
    3.30 +
    3.31     return mfn; 
    3.32  }
    3.33  #define set_machinetophys(_mfn, _pfn) machine_to_phys_mapping[(_mfn)] = (_pfn)