diff options
author | Keir Fraser <keir@xensource.com> | 2007-10-26 16:06:49 +0100 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-10-26 16:06:49 +0100 |
commit | 7f71fbd32bc8436fb8c3eaf6a9b2d254313a8db4 (patch) | |
tree | 8a4e1ddd4a9446ff1a68dc537d125f9e6f2acd18 /xen/arch/x86/flushtlb.c | |
parent | 0059b250dc8cbf9005bf30d88323dc64bb948e9b (diff) | |
download | xen-7f71fbd32bc8436fb8c3eaf6a9b2d254313a8db4.tar.gz xen-7f71fbd32bc8436fb8c3eaf6a9b2d254313a8db4.tar.bz2 xen-7f71fbd32bc8436fb8c3eaf6a9b2d254313a8db4.zip |
x86: Replace FLUSH_LEVEL() parameter to flush_area() with rather
clearer FLUSH_ORDER(). Also remove bogus assertion.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/arch/x86/flushtlb.c')
-rw-r--r-- | xen/arch/x86/flushtlb.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c index 808b848de5..cb0fbb7580 100644 --- a/xen/arch/x86/flushtlb.c +++ b/xen/arch/x86/flushtlb.c @@ -98,17 +98,15 @@ void write_cr3(unsigned long cr3) void flush_area_local(const void *va, unsigned int flags) { const struct cpuinfo_x86 *c = ¤t_cpu_data; - unsigned int level = flags & FLUSH_LEVEL_MASK; + unsigned int order = (flags - 1) & FLUSH_ORDER_MASK; unsigned long irqfl; - ASSERT(level < CONFIG_PAGING_LEVELS); - /* This non-reentrant function is sometimes called in interrupt context. */ local_irq_save(irqfl); if ( flags & (FLUSH_TLB|FLUSH_TLB_GLOBAL) ) { - if ( level == 1 ) + if ( order == 0 ) { /* * We don't INVLPG multi-page regions because the 2M/4M/1G @@ -146,14 +144,14 @@ void flush_area_local(const void *va, unsigned int flags) if ( flags & FLUSH_CACHE ) { - unsigned long i, sz; + unsigned long i, sz = 0; - sz = level ? (1UL << ((level - 1) * PAGETABLE_ORDER)) : ULONG_MAX; + if ( order < (BITS_PER_LONG - PAGE_SHIFT - 1) ) + sz = 1UL << (order + PAGE_SHIFT); - if ( c->x86_clflush_size && c->x86_cache_size && - (sz < (c->x86_cache_size >> (PAGE_SHIFT - 10))) ) + if ( c->x86_clflush_size && c->x86_cache_size && sz && + ((sz >> 10) < c->x86_cache_size) ) { - sz <<= PAGE_SHIFT; va = (const void *)((unsigned long)va & ~(sz - 1)); for ( i = 0; i < sz; i += c->x86_clflush_size ) asm volatile ( "clflush %0" |