ia64/xen-unstable

changeset 3871:aca72468d4fe

bitkeeper revision 1.1205.1.9 (42179612_ThKiOQJXSvUd2fzY_5Zjg)

Minor shadow code cleanups/renames.
author maf46@burn.cl.cam.ac.uk
date Sat Feb 19 19:40:02 2005 +0000 (2005-02-19)
parents 5943b2cd1c2a
children 5950d2ac5f17
files xen/arch/x86/shadow.c xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Sat Feb 19 19:23:13 2005 +0000
     1.2 +++ b/xen/arch/x86/shadow.c	Sat Feb 19 19:40:02 2005 +0000
     1.3 @@ -465,15 +465,15 @@ void vmx_shadow_clear_state(struct domai
     1.4  
     1.5  
     1.6  unsigned long shadow_l2_table( 
     1.7 -    struct domain *d, unsigned long gpfn)
     1.8 +    struct domain *d, unsigned long gmfn)
     1.9  {
    1.10      struct pfn_info *spfn_info;
    1.11      unsigned long    spfn;
    1.12 -    unsigned long guest_gpfn;
    1.13 +    unsigned long    gpfn;
    1.14  
    1.15 -    guest_gpfn = __mfn_to_gpfn(d, gpfn);
    1.16 +    gpfn = __mfn_to_gpfn(d, gmfn);
    1.17  
    1.18 -    SH_VVLOG("shadow_l2_table( %p )", gpfn);
    1.19 +    SH_VVLOG("shadow_l2_table( %p )", gmfn);
    1.20  
    1.21      perfc_incrc(shadow_l2_table_count);
    1.22  
    1.23 @@ -485,14 +485,14 @@ unsigned long shadow_l2_table(
    1.24  
    1.25      spfn = spfn_info - frame_table;
    1.26    /* Mark pfn as being shadowed; update field to point at shadow. */
    1.27 -    set_shadow_status(d, guest_gpfn, spfn | PSH_shadowed);
    1.28 +    set_shadow_status(d, gpfn, spfn | PSH_shadowed);
    1.29   
    1.30  #ifdef __i386__
    1.31      /* Install hypervisor and 2x linear p.t. mapings. */
    1.32      if ( shadow_mode_translate(d) )
    1.33      {
    1.34  #ifdef CONFIG_VMX
    1.35 -        vmx_update_shadow_state(d->exec_domain[0], gpfn, spfn);
    1.36 +        vmx_update_shadow_state(d->exec_domain[0], gmfn, spfn);
    1.37  #else
    1.38          panic("Shadow Full 32 not yet implemented without VMX\n");
    1.39  #endif
    1.40 @@ -514,19 +514,19 @@ unsigned long shadow_l2_table(
    1.41                 &idle_pg_table[DOMAIN_ENTRIES_PER_L2_PAGETABLE],
    1.42                 HYPERVISOR_ENTRIES_PER_L2_PAGETABLE * sizeof(l2_pgentry_t));
    1.43          spl2e[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] =
    1.44 -            mk_l2_pgentry((gpfn << PAGE_SHIFT) | __PAGE_HYPERVISOR);
    1.45 +            mk_l2_pgentry((gmfn << PAGE_SHIFT) | __PAGE_HYPERVISOR);
    1.46          spl2e[SH_LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] =
    1.47              mk_l2_pgentry((spfn << PAGE_SHIFT) | __PAGE_HYPERVISOR);
    1.48          spl2e[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT] =
    1.49              mk_l2_pgentry(__pa(page_get_owner(
    1.50 -                &frame_table[gpfn])->arch.mm_perdomain_pt) |
    1.51 +                &frame_table[gmfn])->arch.mm_perdomain_pt) |
    1.52                            __PAGE_HYPERVISOR);
    1.53  
    1.54          unmap_domain_mem(spl2e);
    1.55      }
    1.56  #endif
    1.57  
    1.58 -    SH_VLOG("shadow_l2_table( %p -> %p)", gpfn, spfn);
    1.59 +    SH_VLOG("shadow_l2_table( %p -> %p)", gmfn, spfn);
    1.60      return spfn;
    1.61  }
    1.62  
     2.1 --- a/xen/include/asm-x86/shadow.h	Sat Feb 19 19:23:13 2005 +0000
     2.2 +++ b/xen/include/asm-x86/shadow.h	Sat Feb 19 19:40:02 2005 +0000
     2.3 @@ -70,7 +70,7 @@ static inline void shadow_mode_disable(s
     2.4  }
     2.5  
     2.6  extern unsigned long shadow_l2_table( 
     2.7 -    struct domain *d, unsigned long gpfn);
     2.8 +    struct domain *d, unsigned long gmfn);
     2.9    
    2.10  static inline void shadow_invalidate(struct exec_domain *ed) {
    2.11      if ( !shadow_mode_translate(ed->domain))
    2.12 @@ -657,7 +657,7 @@ static inline void set_shadow_status(
    2.13  #ifdef CONFIG_VMX
    2.14  
    2.15  static inline void vmx_update_shadow_state(
    2.16 -    struct exec_domain *ed, unsigned long gpfn, unsigned long smfn)
    2.17 +    struct exec_domain *ed, unsigned long gmfn, unsigned long smfn)
    2.18  {
    2.19  
    2.20      l2_pgentry_t *mpl2e = 0;
    2.21 @@ -681,7 +681,7 @@ static inline void vmx_update_shadow_sta
    2.22      __flush_tlb_one(SH_LINEAR_PT_VIRT_START);
    2.23  
    2.24      spl2e = (l2_pgentry_t *)map_domain_mem(smfn << PAGE_SHIFT);
    2.25 -    gpl2e = (l2_pgentry_t *)map_domain_mem(gpfn << PAGE_SHIFT);
    2.26 +    gpl2e = (l2_pgentry_t *)map_domain_mem(gmfn << PAGE_SHIFT);
    2.27      memset(spl2e, 0, L2_PAGETABLE_ENTRIES * sizeof(l2_pgentry_t));
    2.28  
    2.29      ed->arch.shadow_vtable = spl2e;
    2.30 @@ -729,16 +729,19 @@ static inline unsigned long gva_to_gpa(u
    2.31  static inline void __update_pagetables(struct exec_domain *ed)
    2.32  {
    2.33      struct domain *d = ed->domain;
    2.34 -    unsigned long gpfn = pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT;
    2.35 -    unsigned long smfn = __shadow_status(d, gpfn) & PSH_pfn_mask;
    2.36 +    unsigned long gmfn = pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT;
    2.37  
    2.38 -    SH_VVLOG("0: __update_pagetables(gpfn=%p, smfn=%p)", gpfn, smfn);
    2.39 +    // mafetter: BUG: __shadow_status() should take a gpfn, not a gmfn...
    2.40 +    // WHY DOES THIS WORK?
    2.41 +    unsigned long smfn = __shadow_status(d, gmfn) & PSH_pfn_mask;
    2.42 +
    2.43 +    SH_VVLOG("0: __update_pagetables(gmfn=%p, smfn=%p)", gmfn, smfn);
    2.44  
    2.45      if ( unlikely(smfn == 0) )
    2.46 -        smfn = shadow_l2_table(d, gpfn);
    2.47 +        smfn = shadow_l2_table(d, gmfn);
    2.48  #ifdef CONFIG_VMX
    2.49      else if ( shadow_mode_translate(ed->domain) )
    2.50 -        vmx_update_shadow_state(ed, gpfn, smfn);
    2.51 +        vmx_update_shadow_state(ed, gmfn, smfn);
    2.52  #endif
    2.53  
    2.54      ed->arch.shadow_table = mk_pagetable(smfn<<PAGE_SHIFT);