direct-io.hg

view linux-2.4.30-xen-sparse/include/asm-xen/mmu_context.h @ 5517:10e9028c8e3d

bitkeeper revision 1.1718.1.10 (42b7b19aqOS_1M8I4pIOFjiTPYWV-g)

Merge bk://xenbits.xensource.com/xen-unstable.bk
into spot.cl.cam.ac.uk:C:/Documents and Settings/iap10/xen-unstable.bk
author iap10@spot.cl.cam.ac.uk
date Tue Jun 21 06:20:10 2005 +0000 (2005-06-21)
parents 85fcf3b1b7a5
children 56a63f9f378f
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