Signed-off-by: Philippe Gerum <r...@xenomai.org>
---
 arch/blackfin/include/asm/mmu_context.h |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/blackfin/include/asm/mmu_context.h 
b/arch/blackfin/include/asm/mmu_context.h
index 4a3be37..ae87c45 100644
--- a/arch/blackfin/include/asm/mmu_context.h
+++ b/arch/blackfin/include/asm/mmu_context.h
@@ -66,8 +66,8 @@ activate_l1stack(struct mm_struct *mm, unsigned long sp_base)
 
 #define activate_mm(prev, next) switch_mm(prev, next, NULL)
 
-static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct 
*next_mm,
-                            struct task_struct *tsk)
+static inline void __switch_mm(struct mm_struct *prev_mm, struct mm_struct 
*next_mm,
+                              struct task_struct *tsk)
 {
 #ifdef CONFIG_MPU
        unsigned int cpu = smp_processor_id();
@@ -96,6 +96,15 @@ static inline void switch_mm(struct mm_struct *prev_mm, 
struct mm_struct *next_m
 }
 
 #ifdef CONFIG_MPU
+static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+                            struct task_struct *tsk)
+{
+       unsigned long flags;
+       local_irq_save_hw_cond(flags);
+       __switch_mm(prev, next, tsk);
+       local_irq_restore_hw_cond(flags);
+}
+
 static inline void protect_page(struct mm_struct *mm, unsigned long addr,
                                unsigned long flags)
 {
@@ -128,6 +137,12 @@ static inline void update_protections(struct mm_struct *mm)
                set_mask_dcplbs(mm->context.page_rwx_mask, cpu);
        }
 }
+#else /* !CONFIG_MPU */
+static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+                            struct task_struct *tsk)
+{
+       __switch_mm(prev, next, tsk);
+}
 #endif
 
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct 
*tsk)
@@ -173,4 +188,10 @@ static inline void destroy_context(struct mm_struct *mm)
 #endif
 }
 
+#define ipipe_mm_switch_protect(flags)         \
+       local_irq_save_hw_cond(flags)
+
+#define ipipe_mm_switch_unprotect(flags)       \
+       local_irq_restore_hw_cond(flags)
+
 #endif
-- 
1.6.3.3

_______________________________________________
Uclinux-dist-devel mailing list
Uclinux-dist-devel@blackfin.uclinux.org
https://blackfin.uclinux.org/mailman/listinfo/uclinux-dist-devel

Reply via email to