diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2004-06-10 16:59:06 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2004-06-10 16:59:06 +0000 |
commit | 7f68576b77ef3c9fde1009100690ff996d4490e0 (patch) | |
tree | 6a87f66c7a03042baa556676add65252816fbd94 /xen/arch/x86/flushtlb.c | |
parent | 822a0b35350d8006b808000eef3665ee4df7b297 (diff) | |
download | xen-7f68576b77ef3c9fde1009100690ff996d4490e0.tar.gz xen-7f68576b77ef3c9fde1009100690ff996d4490e0.tar.bz2 xen-7f68576b77ef3c9fde1009100690ff996d4490e0.zip |
bitkeeper revision 1.952 (40c8935a3XSRdQfnx5RoO7XgaggvOQ)
Towards x86_64 support. Merged a bunch of the existing x86_64 stuff
back into a generic 'x86' architecture. Aim is to share as much
as possible between 32- and 64-bit worlds.
Diffstat (limited to 'xen/arch/x86/flushtlb.c')
-rw-r--r-- | xen/arch/x86/flushtlb.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c new file mode 100644 index 0000000000..c53f52161c --- /dev/null +++ b/xen/arch/x86/flushtlb.c @@ -0,0 +1,40 @@ +/****************************************************************************** + * flushtlb.c + * + * TLB flushes are timestamped using a global virtual 'clock' which ticks + * on any TLB flush on any processor. + * + * Copyright (c) 2003, K A Fraser + */ + +#include <xen/config.h> +#include <xen/sched.h> +#include <xen/interrupt.h> +#include <asm/flushtlb.h> + +u32 tlbflush_clock; +u32 tlbflush_time[NR_CPUS]; + +void tlb_clocktick(void) +{ + u32 y, ny; + + /* Tick the clock. 'y' contains the current time after the tick. */ + ny = tlbflush_clock; + do { +#ifdef CONFIG_SMP + if ( unlikely(((y = ny+1) & TLBCLOCK_EPOCH_MASK) == 0) ) + { + raise_softirq(NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ); + y = tlbflush_clock; + break; + } +#else + y = ny+1; +#endif + } + while ( unlikely((ny = cmpxchg(&tlbflush_clock, y-1, y)) != y-1) ); + + /* Update this CPU's timestamp to new time. */ + tlbflush_time[smp_processor_id()] = y; +} |