aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include/asm/mmu_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/include/asm/mmu_context.h')
-rw-r--r--arch/blackfin/include/asm/mmu_context.h79
1 files changed, 42 insertions, 37 deletions
diff --git a/arch/blackfin/include/asm/mmu_context.h b/arch/blackfin/include/asm/mmu_context.h
index 8529552a981f..35593dda2a4d 100644
--- a/arch/blackfin/include/asm/mmu_context.h
+++ b/arch/blackfin/include/asm/mmu_context.h
@@ -45,49 +45,12 @@ extern unsigned long l1_stack_len;
45extern int l1sram_free(const void*); 45extern int l1sram_free(const void*);
46extern void *l1sram_alloc_max(void*); 46extern void *l1sram_alloc_max(void*);
47 47
48static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
49{
50}
51
52/* Called when creating a new context during fork() or execve(). */
53static inline int
54init_new_context(struct task_struct *tsk, struct mm_struct *mm)
55{
56#ifdef CONFIG_MPU
57 unsigned long p = __get_free_pages(GFP_KERNEL, page_mask_order);
58 mm->context.page_rwx_mask = (unsigned long *)p;
59 memset(mm->context.page_rwx_mask, 0,
60 page_mask_nelts * 3 * sizeof(long));
61#endif
62 return 0;
63}
64
65static inline void free_l1stack(void) 48static inline void free_l1stack(void)
66{ 49{
67 nr_l1stack_tasks--; 50 nr_l1stack_tasks--;
68 if (nr_l1stack_tasks == 0) 51 if (nr_l1stack_tasks == 0)
69 l1sram_free(l1_stack_base); 52 l1sram_free(l1_stack_base);
70} 53}
71static inline void destroy_context(struct mm_struct *mm)
72{
73 struct sram_list_struct *tmp;
74
75 if (current_l1_stack_save == mm->context.l1_stack_save)
76 current_l1_stack_save = NULL;
77 if (mm->context.l1_stack_save)
78 free_l1stack();
79
80 while ((tmp = mm->context.sram_list)) {
81 mm->context.sram_list = tmp->next;
82 sram_free(tmp->addr);
83 kfree(tmp);
84 }
85#ifdef CONFIG_MPU
86 if (current_rwx_mask == mm->context.page_rwx_mask)
87 current_rwx_mask = NULL;
88 free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order);
89#endif
90}
91 54
92static inline unsigned long 55static inline unsigned long
93alloc_l1stack(unsigned long length, unsigned long *stack_base) 56alloc_l1stack(unsigned long length, unsigned long *stack_base)
@@ -134,6 +97,7 @@ static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_m
134 } 97 }
135#endif 98#endif
136 99
100#ifdef CONFIG_APP_STACK_L1
137 /* L1 stack switching. */ 101 /* L1 stack switching. */
138 if (!next_mm->context.l1_stack_save) 102 if (!next_mm->context.l1_stack_save)
139 return; 103 return;
@@ -144,6 +108,7 @@ static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_m
144 } 108 }
145 current_l1_stack_save = next_mm->context.l1_stack_save; 109 current_l1_stack_save = next_mm->context.l1_stack_save;
146 memcpy(l1_stack_base, current_l1_stack_save, l1_stack_len); 110 memcpy(l1_stack_base, current_l1_stack_save, l1_stack_len);
111#endif
147} 112}
148 113
149#ifdef CONFIG_MPU 114#ifdef CONFIG_MPU
@@ -180,4 +145,44 @@ static inline void update_protections(struct mm_struct *mm)
180} 145}
181#endif 146#endif
182 147
148static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
149{
150}
151
152/* Called when creating a new context during fork() or execve(). */
153static inline int
154init_new_context(struct task_struct *tsk, struct mm_struct *mm)
155{
156#ifdef CONFIG_MPU
157 unsigned long p = __get_free_pages(GFP_KERNEL, page_mask_order);
158 mm->context.page_rwx_mask = (unsigned long *)p;
159 memset(mm->context.page_rwx_mask, 0,
160 page_mask_nelts * 3 * sizeof(long));
161#endif
162 return 0;
163}
164
165static inline void destroy_context(struct mm_struct *mm)
166{
167 struct sram_list_struct *tmp;
168
169#ifdef CONFIG_APP_STACK_L1
170 if (current_l1_stack_save == mm->context.l1_stack_save)
171 current_l1_stack_save = 0;
172 if (mm->context.l1_stack_save)
173 free_l1stack();
174#endif
175
176 while ((tmp = mm->context.sram_list)) {
177 mm->context.sram_list = tmp->next;
178 sram_free(tmp->addr);
179 kfree(tmp);
180 }
181#ifdef CONFIG_MPU
182 if (current_rwx_mask == mm->context.page_rwx_mask)
183 current_rwx_mask = NULL;
184 free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order);
185#endif
186}
187
183#endif 188#endif