direct-io.hg

changeset 10237:121ec8b952d3

[HVM] Fix set_guest_back_ptr to ignore empty PTEs.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@dhcp93.uk.xensource.com
date Thu Jun 01 10:50:33 2006 +0100 (2006-06-01)
parents 09d9d6e7b985
children 2a0208b33c30
files xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/include/asm-x86/shadow.h	Thu Jun 01 10:34:21 2006 +0100
     1.2 +++ b/xen/include/asm-x86/shadow.h	Thu Jun 01 10:50:33 2006 +0100
     1.3 @@ -756,23 +756,26 @@ shadow_unpin(unsigned long smfn)
     1.4   * when working on finer-gained locks for shadow.
     1.5   */
     1.6  static inline void set_guest_back_ptr(
     1.7 -    struct domain *d, l1_pgentry_t spte, unsigned long smfn, unsigned int index)
     1.8 +    struct domain *d, l1_pgentry_t spte,
     1.9 +    unsigned long smfn, unsigned int index)
    1.10  {
    1.11 -    if ( shadow_mode_external(d) ) {
    1.12 -        unsigned long gmfn;
    1.13 +    struct page_info *gpage;
    1.14 +
    1.15 +    ASSERT(shadow_lock_is_acquired(d));
    1.16  
    1.17 -        ASSERT(shadow_lock_is_acquired(d));
    1.18 -        ASSERT( smfn );
    1.19 -        gmfn = l1e_get_pfn(spte);
    1.20 -        ASSERT( gmfn );
    1.21 -        if ( l1e_get_flags(spte) & _PAGE_RW )
    1.22 -        {
    1.23 -            mfn_to_page(gmfn)->tlbflush_timestamp = smfn;
    1.24 -            mfn_to_page(gmfn)->u.inuse.type_info &= ~PGT_va_mask;
    1.25 -            mfn_to_page(gmfn)->u.inuse.type_info |= 
    1.26 -                (unsigned long) index << PGT_va_shift;
    1.27 -        }
    1.28 -    }
    1.29 +    if ( !shadow_mode_external(d) || 
    1.30 +         ((l1e_get_flags(spte) & (_PAGE_PRESENT|_PAGE_RW)) !=
    1.31 +          (_PAGE_PRESENT|_PAGE_RW)) )
    1.32 +        return;
    1.33 +
    1.34 +    gpage = l1e_get_page(spte);
    1.35 +
    1.36 +    ASSERT(smfn != 0);
    1.37 +    ASSERT(page_to_mfn(gpage) != 0);
    1.38 +
    1.39 +    gpage->tlbflush_timestamp = smfn;
    1.40 +    gpage->u.inuse.type_info &= ~PGT_va_mask;
    1.41 +    gpage->u.inuse.type_info |= (unsigned long)index << PGT_va_shift;
    1.42  }
    1.43  
    1.44  /************************************************************************/