direct-io.hg

changeset 11213:069ac1bb7866

[XEN] Fix shadow2 integration with writable-pagetable logic.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Aug 21 10:28:02 2006 +0100 (2006-08-21)
parents 58ed222274f2
children 36220033c67f
files xen/arch/x86/mm.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Mon Aug 21 09:01:53 2006 +0100
     1.2 +++ b/xen/arch/x86/mm.c	Mon Aug 21 10:28:02 2006 +0100
     1.3 @@ -3139,13 +3139,14 @@ static int ptwr_emulated_update(
     1.4          }
     1.5      }
     1.6  
     1.7 -    /* Checked successfully: do the update (write or cmpxchg). */
     1.8      pl1e = map_domain_page(page_to_mfn(page));
     1.9      pl1e = (l1_pgentry_t *)((unsigned long)pl1e + (addr & ~PAGE_MASK));
    1.10 +
    1.11 +    if ( shadow2_mode_enabled(d) )
    1.12 +        shadow2_lock(d);
    1.13 +
    1.14      if ( do_cmpxchg )
    1.15      {
    1.16 -        if ( shadow2_mode_enabled(d) )
    1.17 -            shadow2_lock(d);
    1.18          ol1e = l1e_from_intpte(old);
    1.19          if ( cmpxchg((intpte_t *)pl1e, old, val) != old )
    1.20          {
    1.21 @@ -3155,11 +3156,6 @@ static int ptwr_emulated_update(
    1.22              put_page_from_l1e(nl1e, d);
    1.23              return X86EMUL_CMPXCHG_FAILED;
    1.24          }
    1.25 -        if ( unlikely(shadow2_mode_enabled(v->domain)) )
    1.26 -        {
    1.27 -            shadow2_validate_guest_entry(v, _mfn(page_to_mfn(page)), pl1e);
    1.28 -            shadow2_unlock(v->domain);    
    1.29 -        }
    1.30      }
    1.31      else
    1.32      {
    1.33 @@ -3168,6 +3164,12 @@ static int ptwr_emulated_update(
    1.34              BUG();
    1.35      }
    1.36  
    1.37 +    if ( shadow2_mode_enabled(d) )
    1.38 +    {
    1.39 +        shadow2_validate_guest_entry(v, _mfn(page_to_mfn(page)), pl1e);
    1.40 +        shadow2_unlock(v->domain);    
    1.41 +    }
    1.42 +
    1.43      unmap_domain_page(pl1e);
    1.44  
    1.45      /* Finally, drop the old PTE. */