ia64/xen-unstable

changeset 9047:cc9ed0eea55a

Fix a missed unmap in __entry().
On x86_32p, after several creation/destroy of VMX domain, xen crashes
because we forget to unmap phys_table.

Signed-off-by: Xin Li <xin.b.li@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Feb 27 16:20:23 2006 +0100 (2006-02-27)
parents d741fa272309
children 0cb40b7f7840
files xen/include/asm-x86/shadow_64.h
line diff
     1.1 --- a/xen/include/asm-x86/shadow_64.h	Mon Feb 27 16:14:11 2006 +0100
     1.2 +++ b/xen/include/asm-x86/shadow_64.h	Mon Feb 27 16:20:23 2006 +0100
     1.3 @@ -223,6 +223,7 @@ static inline int __entry(
     1.4      int i;
     1.5      pgentry_64_t *le_e;
     1.6      pgentry_64_t *le_p = NULL;
     1.7 +    pgentry_64_t *phys_vtable = NULL;
     1.8      unsigned long mfn;
     1.9      int index;
    1.10      u32 level = flag & L_MASK;
    1.11 @@ -251,25 +252,35 @@ static inline int __entry(
    1.12      {
    1.13          root_level = PAE_PAGING_LEVELS;
    1.14          index = table_offset_64(va, root_level);
    1.15 -        le_e = (pgentry_64_t *)map_domain_page(
    1.16 +        phys_vtable = (pgentry_64_t *)map_domain_page(
    1.17              pagetable_get_pfn(v->domain->arch.phys_table));
    1.18 +        le_e = &phys_vtable[index];
    1.19      }
    1.20  
    1.21      /*
    1.22       * If it's not external mode, then mfn should be machine physical.
    1.23       */
    1.24 -    for (i = root_level - level; i > 0; i--) {
    1.25 -        if ( unlikely(!(entry_get_flags(*le_e) & _PAGE_PRESENT)) ) {
    1.26 +    for ( i = root_level - level; i > 0; i-- )
    1.27 +    {
    1.28 +        if ( unlikely(!(entry_get_flags(*le_e) & _PAGE_PRESENT)) )
    1.29 +        {
    1.30              if ( le_p )
    1.31                  unmap_domain_page(le_p);
    1.32 +
    1.33 +            if ( phys_vtable )
    1.34 +                unmap_domain_page(phys_vtable);
    1.35 +
    1.36              return 0;
    1.37          }
    1.38 +
    1.39          mfn = entry_get_pfn(*le_e);
    1.40          if ( (flag & GUEST_ENTRY) && shadow_mode_translate(d) )
    1.41              mfn = get_mfn_from_gpfn(mfn);
    1.42 +
    1.43          if ( le_p )
    1.44              unmap_domain_page(le_p);
    1.45          le_p = (pgentry_64_t *)map_domain_page(mfn);
    1.46 +
    1.47          if ( flag & SHADOW_ENTRY )
    1.48              index = table_offset_64(va, (level + i - 1));
    1.49          else
    1.50 @@ -285,8 +296,10 @@ static inline int __entry(
    1.51      if ( le_p )
    1.52          unmap_domain_page(le_p);
    1.53  
    1.54 +    if ( phys_vtable )
    1.55 +        unmap_domain_page(phys_vtable);
    1.56 +
    1.57      return 1;
    1.58 -
    1.59  }
    1.60  
    1.61  static inline int __rw_entry(