ia64/xen-unstable

changeset 17087:9d29141a5e52

x86: Fix mod_l3_entry() for PAE-on-64 guests. The adjustment of
_PAGE_RW and _PAGE_USER cannot happen before get_page_from_l3e().

Original patch by Manuel Bouyer <bouyer@netbsd.org>.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Feb 18 13:50:25 2008 +0000 (2008-02-18)
parents eb418cb71d4b
children 8848d9e07584
files xen/arch/x86/mm.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Mon Feb 18 09:35:39 2008 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Mon Feb 18 13:50:25 2008 +0000
     1.3 @@ -1443,16 +1443,18 @@ static int mod_l1_entry(l1_pgentry_t *pl
     1.4              return 0;
     1.5          }
     1.6  
     1.7 -        adjust_guest_l1e(nl1e, d);
     1.8 -
     1.9          /* Fast path for identical mapping, r/w and presence. */
    1.10          if ( !l1e_has_changed(ol1e, nl1e, _PAGE_RW | _PAGE_PRESENT) )
    1.11 +        {
    1.12 +            adjust_guest_l1e(nl1e, d);
    1.13              return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr,
    1.14                                  preserve_ad);
    1.15 +        }
    1.16  
    1.17          if ( unlikely(!get_page_from_l1e(nl1e, FOREIGNDOM)) )
    1.18              return 0;
    1.19          
    1.20 +        adjust_guest_l1e(nl1e, d);
    1.21          if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr,
    1.22                                      preserve_ad)) )
    1.23          {
    1.24 @@ -1501,15 +1503,17 @@ static int mod_l2_entry(l2_pgentry_t *pl
    1.25              return 0;
    1.26          }
    1.27  
    1.28 -        adjust_guest_l2e(nl2e, d);
    1.29 -
    1.30          /* Fast path for identical mapping and presence. */
    1.31 -        if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT))
    1.32 +        if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT) )
    1.33 +        {
    1.34 +            adjust_guest_l2e(nl2e, d);
    1.35              return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr, preserve_ad);
    1.36 +        }
    1.37  
    1.38          if ( unlikely(!get_page_from_l2e(nl2e, pfn, d)) )
    1.39              return 0;
    1.40  
    1.41 +        adjust_guest_l2e(nl2e, d);
    1.42          if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr,
    1.43                                      preserve_ad)) )
    1.44          {
    1.45 @@ -1567,15 +1571,17 @@ static int mod_l3_entry(l3_pgentry_t *pl
    1.46              return 0;
    1.47          }
    1.48  
    1.49 -        adjust_guest_l3e(nl3e, d);
    1.50 -
    1.51          /* Fast path for identical mapping and presence. */
    1.52 -        if (!l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT))
    1.53 +        if ( !l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT) )
    1.54 +        {
    1.55 +            adjust_guest_l3e(nl3e, d);
    1.56              return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr, preserve_ad);
    1.57 +        }
    1.58  
    1.59          if ( unlikely(!get_page_from_l3e(nl3e, pfn, d)) )
    1.60              return 0;
    1.61  
    1.62 +        adjust_guest_l3e(nl3e, d);
    1.63          if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr,
    1.64                                      preserve_ad)) )
    1.65          {
    1.66 @@ -1630,15 +1636,17 @@ static int mod_l4_entry(l4_pgentry_t *pl
    1.67              return 0;
    1.68          }
    1.69  
    1.70 -        adjust_guest_l4e(nl4e, d);
    1.71 -
    1.72          /* Fast path for identical mapping and presence. */
    1.73 -        if (!l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT))
    1.74 +        if ( !l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT) )
    1.75 +        {
    1.76 +            adjust_guest_l4e(nl4e, d);
    1.77              return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr, preserve_ad);
    1.78 +        }
    1.79  
    1.80          if ( unlikely(!get_page_from_l4e(nl4e, pfn, d)) )
    1.81              return 0;
    1.82  
    1.83 +        adjust_guest_l4e(nl4e, d);
    1.84          if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr,
    1.85                                      preserve_ad)) )
    1.86          {