ia64/xen-unstable

view linux-2.4-xen-sparse/include/asm-xen/mmu_context.h @ 6538:84ee014ebd41

Merge xen-vtx-unstable.hg
author adsharma@los-vmm.sc.intel.com
date Wed Aug 17 12:34:38 2005 -0800 (2005-08-17)
parents 23979fb12c49 f294acb25858
children 99914b54f7bf
line source
1 #ifndef __I386_MMU_CONTEXT_H
2 #define __I386_MMU_CONTEXT_H
4 #include <linux/config.h>
5 #include <asm/desc.h>
6 #include <asm/atomic.h>
7 #include <asm/pgalloc.h>
9 /*
10 * hooks to add arch specific data into the mm struct.
11 * Note that destroy_context is called even if init_new_context
12 * fails.
13 */
14 int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
15 void destroy_context(struct mm_struct *mm);
17 #ifdef CONFIG_SMP
19 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
20 {
21 if(cpu_tlbstate[cpu].state == TLBSTATE_OK)
22 cpu_tlbstate[cpu].state = TLBSTATE_LAZY;
23 }
24 #else
25 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
26 {
27 }
28 #endif
30 extern pgd_t *cur_pgd;
32 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
33 {
34 struct mmuext_op _op[2], *op = _op;
35 if (prev != next) {
36 /* stop flush ipis for the previous mm */
37 clear_bit(cpu, &prev->cpu_vm_mask);
38 /* Re-load page tables */
39 cur_pgd = next->pgd;
40 op->cmd = MMUEXT_NEW_BASEPTR;
41 op->mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
42 op++;
43 /* load_LDT, if either the previous or next thread
44 * has a non-default LDT.
45 */
46 if (next->context.size+prev->context.size) {
47 op->cmd = MMUEXT_SET_LDT;
48 op->linear_addr = (unsigned long)next->context.ldt;
49 op->nr_ents = next->context.size;
50 op++;
51 }
52 BUG_ON(HYPERVISOR_mmuext_op(_op, op-_op, NULL, DOMID_SELF));
53 }
54 }
56 #define activate_mm(prev, next) \
57 switch_mm((prev),(next),NULL,smp_processor_id())
59 #endif