ia64/xen-unstable

changeset 18006:f3afb8625a92

p2m: Support page orders other than 0 (4kB) and 9 (2MB)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jul 09 11:04:18 2008 +0100 (2008-07-09)
parents 06bcd8f622c8
children af555a012e67
files xen/arch/x86/mm/p2m.c
line diff
     1.1 --- a/xen/arch/x86/mm/p2m.c	Wed Jul 09 11:02:37 2008 +0100
     1.2 +++ b/xen/arch/x86/mm/p2m.c	Wed Jul 09 11:04:18 2008 +0100
     1.3 @@ -530,11 +530,25 @@ void p2m_change_entry_type_global(struct
     1.4      p2m_unlock(p2m);
     1.5  }
     1.6  
     1.7 -static inline
     1.8 +static
     1.9  int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, 
    1.10 -                  unsigned int page_order, p2m_type_t p2mt)
    1.11 +                    unsigned int page_order, p2m_type_t p2mt)
    1.12  {
    1.13 -    return d->arch.p2m->set_entry(d, gfn, mfn, page_order, p2mt);
    1.14 +    unsigned long todo = 1ul << page_order;
    1.15 +    unsigned int order;
    1.16 +    int rc = 0;
    1.17 +
    1.18 +    while ( todo )
    1.19 +    {
    1.20 +        order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0;
    1.21 +        rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt);
    1.22 +        gfn += 1ul << order;
    1.23 +        if ( mfn_x(mfn) != INVALID_MFN )
    1.24 +            mfn = _mfn(mfn_x(mfn) + (1ul << order));
    1.25 +        todo -= 1ul << order;
    1.26 +    }
    1.27 +
    1.28 +    return rc;
    1.29  }
    1.30  
    1.31  // Allocate a new p2m table for a domain.