ia64/xen-unstable

changeset 10221:ec1e371ec320

[HVM] Fix shadow mode to not corrupt frame 0's page_info struct.
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed May 31 07:25:59 2006 +0100 (2006-05-31)
parents 86062ecef294
children e5de45e2edaf
files xen/arch/x86/shadow.c xen/arch/x86/shadow32.c xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Wed May 31 07:23:54 2006 +0100
     1.2 +++ b/xen/arch/x86/shadow.c	Wed May 31 07:25:59 2006 +0100
     1.3 @@ -1724,7 +1724,8 @@ static int resync_all(struct domain *d, 
     1.4                          unshadow_l1 = 1;
     1.5                      else {
     1.6                          need_flush |= error;
     1.7 -                        set_guest_back_ptr(d, *sl1e_p, smfn, i);
     1.8 +                        if ( l1e_get_flags(*sl1e_p) & _PAGE_PRESENT )
     1.9 +                            set_guest_back_ptr(d, *sl1e_p, smfn, i);
    1.10                      }
    1.11                      // can't update snapshots of linear page tables -- they
    1.12                      // are used multiple times...
     2.1 --- a/xen/arch/x86/shadow32.c	Wed May 31 07:23:54 2006 +0100
     2.2 +++ b/xen/arch/x86/shadow32.c	Wed May 31 07:25:59 2006 +0100
     2.3 @@ -2691,7 +2691,8 @@ static int resync_all(struct domain *d, 
     2.4                          unshadow_l1 = 1;
     2.5                      else {
     2.6                          need_flush |= error;
     2.7 -                        set_guest_back_ptr(d, shadow1[i], smfn, i);
     2.8 +                        if ( l1e_get_flags(shadow1[i]) & _PAGE_PRESENT )
     2.9 +                            set_guest_back_ptr(d, shadow1[i], smfn, i);
    2.10                      }
    2.11  
    2.12                      // can't update snapshots of linear page tables -- they
     3.1 --- a/xen/include/asm-x86/shadow.h	Wed May 31 07:23:54 2006 +0100
     3.2 +++ b/xen/include/asm-x86/shadow.h	Wed May 31 07:25:59 2006 +0100
     3.3 @@ -762,10 +762,16 @@ static inline void set_guest_back_ptr(
     3.4          unsigned long gmfn;
     3.5  
     3.6          ASSERT(shadow_lock_is_acquired(d));
     3.7 +        ASSERT( smfn );
     3.8          gmfn = l1e_get_pfn(spte);
     3.9 -        mfn_to_page(gmfn)->tlbflush_timestamp = smfn;
    3.10 -        mfn_to_page(gmfn)->u.inuse.type_info &= ~PGT_va_mask;
    3.11 -        mfn_to_page(gmfn)->u.inuse.type_info |= (unsigned long) index << PGT_va_shift;
    3.12 +        ASSERT( gmfn );
    3.13 +        if ( l1e_get_flags(spte) & _PAGE_RW )
    3.14 +        {
    3.15 +            mfn_to_page(gmfn)->tlbflush_timestamp = smfn;
    3.16 +            mfn_to_page(gmfn)->u.inuse.type_info &= ~PGT_va_mask;
    3.17 +            mfn_to_page(gmfn)->u.inuse.type_info |= 
    3.18 +                (unsigned long) index << PGT_va_shift;
    3.19 +        }
    3.20      }
    3.21  }
    3.22