aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/slb.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2009-07-13 16:53:52 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-19 20:12:25 -0400
commit5eb9bac0406f2beb84b21aac6feb89d33d9f3f5c (patch)
tree04b7dfa2acd16f308a161f6baab2a83e024951b1 /arch/powerpc/mm/slb.c
parent30d0b3682887a81f0335b42f20116fd40d743371 (diff)
powerpc: Rearrange SLB preload code
With the new top down layout it is likely that the pc and stack will be in the same segment, because the pc is most likely in a library allocated via a top down mmap. Right now we bail out early if these segments match. Rearrange the SLB preload code to sanity check all SLB preload addresses are not in the kernel, then check all addresses for conflicts. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/mm/slb.c')
-rw-r--r--arch/powerpc/mm/slb.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 5b7038f248b6..227056c21eee 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -218,23 +218,18 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
218 else 218 else
219 unmapped_base = TASK_UNMAPPED_BASE_USER64; 219 unmapped_base = TASK_UNMAPPED_BASE_USER64;
220 220
221 if (is_kernel_addr(pc)) 221 if (is_kernel_addr(pc) || is_kernel_addr(stack) ||
222 return; 222 is_kernel_addr(unmapped_base))
223 slb_allocate(pc);
224
225 if (esids_match(pc,stack))
226 return; 223 return;
227 224
228 if (is_kernel_addr(stack)) 225 slb_allocate(pc);
229 return;
230 slb_allocate(stack);
231 226
232 if (esids_match(pc,unmapped_base) || esids_match(stack,unmapped_base)) 227 if (!esids_match(pc, stack))
233 return; 228 slb_allocate(stack);
234 229
235 if (is_kernel_addr(unmapped_base)) 230 if (!esids_match(pc, unmapped_base) &&
236 return; 231 !esids_match(stack, unmapped_base))
237 slb_allocate(unmapped_base); 232 slb_allocate(unmapped_base);
238} 233}
239 234
240static inline void patch_slb_encoding(unsigned int *insn_addr, 235static inline void patch_slb_encoding(unsigned int *insn_addr,