diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-06-25 00:19:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 07:10:31 -0400 |
commit | c3c2fee38462fa34b90e0a5427c7fc564bb5c96c (patch) | |
tree | a09e6e2081069f694e70e59915e2cf7c26ba0169 | |
parent | fb15a9b3047a245a30a51696e4d8e29b1175a598 (diff) |
x86: unify mmu_context.h
Some amount of asm-x86/mmu_context.h can be unified, including
activate_mm paravirt hook.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/asm-x86/mmu_context.h | 32 | ||||
-rw-r--r-- | include/asm-x86/mmu_context_32.h | 28 | ||||
-rw-r--r-- | include/asm-x86/mmu_context_64.h | 18 |
3 files changed, 32 insertions, 46 deletions
diff --git a/include/asm-x86/mmu_context.h b/include/asm-x86/mmu_context.h index 6598450da6c6..fac57014e7c6 100644 --- a/include/asm-x86/mmu_context.h +++ b/include/asm-x86/mmu_context.h | |||
@@ -1,5 +1,37 @@ | |||
1 | #ifndef __ASM_X86_MMU_CONTEXT_H | ||
2 | #define __ASM_X86_MMU_CONTEXT_H | ||
3 | |||
4 | #include <asm/desc.h> | ||
5 | #include <asm/atomic.h> | ||
6 | #include <asm/pgalloc.h> | ||
7 | #include <asm/tlbflush.h> | ||
8 | #include <asm/paravirt.h> | ||
9 | #ifndef CONFIG_PARAVIRT | ||
10 | #include <asm-generic/mm_hooks.h> | ||
11 | |||
12 | static inline void paravirt_activate_mm(struct mm_struct *prev, | ||
13 | struct mm_struct *next) | ||
14 | { | ||
15 | } | ||
16 | #endif /* !CONFIG_PARAVIRT */ | ||
17 | |||
18 | /* | ||
19 | * Used for LDT copy/destruction. | ||
20 | */ | ||
21 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | ||
22 | void destroy_context(struct mm_struct *mm); | ||
23 | |||
1 | #ifdef CONFIG_X86_32 | 24 | #ifdef CONFIG_X86_32 |
2 | # include "mmu_context_32.h" | 25 | # include "mmu_context_32.h" |
3 | #else | 26 | #else |
4 | # include "mmu_context_64.h" | 27 | # include "mmu_context_64.h" |
5 | #endif | 28 | #endif |
29 | |||
30 | #define activate_mm(prev, next) \ | ||
31 | do { \ | ||
32 | paravirt_activate_mm((prev), (next)); \ | ||
33 | switch_mm((prev), (next), NULL); \ | ||
34 | } while (0); | ||
35 | |||
36 | |||
37 | #endif /* __ASM_X86_MMU_CONTEXT_H */ | ||
diff --git a/include/asm-x86/mmu_context_32.h b/include/asm-x86/mmu_context_32.h index 9756ae0f1dd3..824fc575c6d8 100644 --- a/include/asm-x86/mmu_context_32.h +++ b/include/asm-x86/mmu_context_32.h | |||
@@ -1,28 +1,6 @@ | |||
1 | #ifndef __I386_SCHED_H | 1 | #ifndef __I386_SCHED_H |
2 | #define __I386_SCHED_H | 2 | #define __I386_SCHED_H |
3 | 3 | ||
4 | #include <asm/desc.h> | ||
5 | #include <asm/atomic.h> | ||
6 | #include <asm/pgalloc.h> | ||
7 | #include <asm/tlbflush.h> | ||
8 | #include <asm/paravirt.h> | ||
9 | #ifndef CONFIG_PARAVIRT | ||
10 | #include <asm-generic/mm_hooks.h> | ||
11 | |||
12 | static inline void paravirt_activate_mm(struct mm_struct *prev, | ||
13 | struct mm_struct *next) | ||
14 | { | ||
15 | } | ||
16 | #endif /* !CONFIG_PARAVIRT */ | ||
17 | |||
18 | |||
19 | /* | ||
20 | * Used for LDT copy/destruction. | ||
21 | */ | ||
22 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | ||
23 | void destroy_context(struct mm_struct *mm); | ||
24 | |||
25 | |||
26 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | 4 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) |
27 | { | 5 | { |
28 | #ifdef CONFIG_SMP | 6 | #ifdef CONFIG_SMP |
@@ -75,10 +53,4 @@ static inline void switch_mm(struct mm_struct *prev, | |||
75 | #define deactivate_mm(tsk, mm) \ | 53 | #define deactivate_mm(tsk, mm) \ |
76 | asm("movl %0,%%gs": :"r" (0)); | 54 | asm("movl %0,%%gs": :"r" (0)); |
77 | 55 | ||
78 | #define activate_mm(prev, next) \ | ||
79 | do { \ | ||
80 | paravirt_activate_mm((prev), (next)); \ | ||
81 | switch_mm((prev), (next), NULL); \ | ||
82 | } while (0); | ||
83 | |||
84 | #endif | 56 | #endif |
diff --git a/include/asm-x86/mmu_context_64.h b/include/asm-x86/mmu_context_64.h index ca44c71e7fb3..c7000634ccae 100644 --- a/include/asm-x86/mmu_context_64.h +++ b/include/asm-x86/mmu_context_64.h | |||
@@ -1,21 +1,7 @@ | |||
1 | #ifndef __X86_64_MMU_CONTEXT_H | 1 | #ifndef __X86_64_MMU_CONTEXT_H |
2 | #define __X86_64_MMU_CONTEXT_H | 2 | #define __X86_64_MMU_CONTEXT_H |
3 | 3 | ||
4 | #include <asm/desc.h> | ||
5 | #include <asm/atomic.h> | ||
6 | #include <asm/pgalloc.h> | ||
7 | #include <asm/pda.h> | 4 | #include <asm/pda.h> |
8 | #include <asm/pgtable.h> | ||
9 | #include <asm/tlbflush.h> | ||
10 | #ifndef CONFIG_PARAVIRT | ||
11 | #include <asm-generic/mm_hooks.h> | ||
12 | #endif | ||
13 | |||
14 | /* | ||
15 | * possibly do the LDT unload here? | ||
16 | */ | ||
17 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | ||
18 | void destroy_context(struct mm_struct *mm); | ||
19 | 5 | ||
20 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | 6 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) |
21 | { | 7 | { |
@@ -65,8 +51,4 @@ do { \ | |||
65 | asm volatile("movl %0,%%fs"::"r"(0)); \ | 51 | asm volatile("movl %0,%%fs"::"r"(0)); \ |
66 | } while (0) | 52 | } while (0) |
67 | 53 | ||
68 | #define activate_mm(prev, next) \ | ||
69 | switch_mm((prev), (next), NULL) | ||
70 | |||
71 | |||
72 | #endif | 54 | #endif |