ia64/xen-unstable

changeset 8595:0c5980d0bf20

Fix writable pagetables when a flush happens in a different
domain, which is temporarily made to run on the wrong
pagetables.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jan 13 16:27:45 2006 +0100 (2006-01-13)
parents 026e5ef0aa3c
children c1840ac1f05d
files xen/arch/x86/mm.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Fri Jan 13 16:09:45 2006 +0100
     1.2 +++ b/xen/arch/x86/mm.c	Fri Jan 13 16:27:45 2006 +0100
     1.3 @@ -3023,12 +3023,25 @@ void ptwr_flush(struct domain *d, const 
     1.4       * STEP 2. Validate any modified PTEs.
     1.5       */
     1.6  
     1.7 -    pl1e = map_domain_page(l1e_get_pfn(pte));
     1.8 -    modified = revalidate_l1(d, pl1e, d->arch.ptwr[which].page);
     1.9 -    unmap_domain_page(pl1e);
    1.10 -    perfc_incr_histo(wpt_updates, modified, PT_UPDATES);
    1.11 -    ptwr_eip_stat_update(d->arch.ptwr[which].eip, d->domain_id, modified);
    1.12 -    d->arch.ptwr[which].prev_nr_updates = modified;
    1.13 +    if ( likely(d == current->domain) )
    1.14 +    {
    1.15 +        pl1e = map_domain_page(l1e_get_pfn(pte));
    1.16 +        modified = revalidate_l1(d, pl1e, d->arch.ptwr[which].page);
    1.17 +        unmap_domain_page(pl1e);
    1.18 +        perfc_incr_histo(wpt_updates, modified, PT_UPDATES);
    1.19 +        ptwr_eip_stat_update(d->arch.ptwr[which].eip, d->domain_id, modified);
    1.20 +        d->arch.ptwr[which].prev_nr_updates = modified;
    1.21 +    }
    1.22 +    else
    1.23 +    {
    1.24 +        /*
    1.25 +         * Must make a temporary global mapping, since we are running in the
    1.26 +         * wrong address space, so no access to our own mapcache.
    1.27 +         */
    1.28 +        pl1e = map_domain_page_global(l1e_get_pfn(pte));
    1.29 +        modified = revalidate_l1(d, pl1e, d->arch.ptwr[which].page);
    1.30 +        unmap_domain_page_global(pl1e);
    1.31 +    }
    1.32  
    1.33      /*
    1.34       * STEP 3. Reattach the L1 p.t. page into the current address space.