2.6.31 support (WiP)
[openwrt/staging/chunkeey.git] / target / linux / coldfire / patches / 053-mcfv4e_brcache_inval.patch
1 From eba69831e8f35174e2e15e373a66f40dc0be8929 Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Wed, 14 May 2008 12:23:12 -0600
4 Subject: [PATCH] Force branch-cache invalidate on task switch.
5
6 When finishing a task switch make sure the branch cache
7 gets invalidated to ensure no stale entries exist for
8 the next user space.
9
10 LTIBName: mcfv4e-brcache-inval
11 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
12 ---
13 include/asm-m68k/system.h | 15 +++++++++++++++
14 1 files changed, 15 insertions(+), 0 deletions(-)
15
16 --- a/include/asm-m68k/system.h
17 +++ b/include/asm-m68k/system.h
18 @@ -5,9 +5,24 @@
19 #include <linux/kernel.h>
20 #include <asm/segment.h>
21 #include <asm/entry.h>
22 +#include <asm/cfcache.h>
23
24 #ifdef __KERNEL__
25
26 +#ifdef CONFIG_COLDFIRE
27 +#define FLUSH_BC (0x00040000)
28 +
29 +#define finish_arch_switch(prev) do { \
30 + unsigned long tmpreg; \
31 + asm volatile ( "move.l %2,%0\n" \
32 + "orl %1,%0\n" \
33 + "movec %0,%%cacr" \
34 + : "=&d" (tmpreg) \
35 + : "id" (FLUSH_BC), "m" (shadow_cacr)); \
36 + } while(0)
37 +
38 +#endif
39 +
40 /*
41 * switch_to(n) should switch tasks to task ptr, first checking that
42 * ptr isn't the current task, in which case it does nothing. This