diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2005-05-31 17:39:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-31 17:54:18 -0400 |
commit | ae92ef8a442421356950a0a8dfdc35e8e783000e (patch) | |
tree | ddfad1eff028815ff32fd9f21b6e18df4e3804ae /kernel/module.c | |
parent | f50734569c25c4e902bd3d0fb2e5bd93a200cc75 (diff) |
[PATCH] flush icache in correct context
flush_icache_range() is used in two different situation - in binfmt_elf.c &
co for user space mappings and module.c for kernel modules. On m68k
flush_icache_range() doesn't know which data to flush, as it has separate
address spaces and the pointer argument can be valid in either address
space.
First I considered splitting flush_icache_range(), but this patch is
simpler. Setting the correct context gives flush_icache_range() enough
information to flush the correct data.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index 5734ab09d3f9..83b3d376708c 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1758,6 +1758,7 @@ sys_init_module(void __user *umod, | |||
1758 | const char __user *uargs) | 1758 | const char __user *uargs) |
1759 | { | 1759 | { |
1760 | struct module *mod; | 1760 | struct module *mod; |
1761 | mm_segment_t old_fs = get_fs(); | ||
1761 | int ret = 0; | 1762 | int ret = 0; |
1762 | 1763 | ||
1763 | /* Must have permission */ | 1764 | /* Must have permission */ |
@@ -1775,6 +1776,9 @@ sys_init_module(void __user *umod, | |||
1775 | return PTR_ERR(mod); | 1776 | return PTR_ERR(mod); |
1776 | } | 1777 | } |
1777 | 1778 | ||
1779 | /* flush the icache in correct context */ | ||
1780 | set_fs(KERNEL_DS); | ||
1781 | |||
1778 | /* Flush the instruction cache, since we've played with text */ | 1782 | /* Flush the instruction cache, since we've played with text */ |
1779 | if (mod->module_init) | 1783 | if (mod->module_init) |
1780 | flush_icache_range((unsigned long)mod->module_init, | 1784 | flush_icache_range((unsigned long)mod->module_init, |
@@ -1783,6 +1787,8 @@ sys_init_module(void __user *umod, | |||
1783 | flush_icache_range((unsigned long)mod->module_core, | 1787 | flush_icache_range((unsigned long)mod->module_core, |
1784 | (unsigned long)mod->module_core + mod->core_size); | 1788 | (unsigned long)mod->module_core + mod->core_size); |
1785 | 1789 | ||
1790 | set_fs(old_fs); | ||
1791 | |||
1786 | /* Now sew it into the lists. They won't access us, since | 1792 | /* Now sew it into the lists. They won't access us, since |
1787 | strong_try_module_get() will fail. */ | 1793 | strong_try_module_get() will fail. */ |
1788 | stop_machine_run(__link_module, mod, NR_CPUS); | 1794 | stop_machine_run(__link_module, mod, NR_CPUS); |