aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2013-09-19 05:15:49 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-09-19 05:23:10 -0400
commit8b8a7634315be747959b0165e38138879f93cf6c (patch)
tree8559e2a5ba5149aff5079713e28945b226faca96
parent2f9ee82c2a1af01966cedaa9cb144acb6fca9932 (diff)
MIPS: Disable usermode switching of the FR bit for MIPS R5 CPUs.
Currently the kernel will always use the FR=0 register model for O32. If an O32 application did enable FR=1 mode, some data from another application might be leaked in the extra registers becoming visible. Iow, this patch is meant to make the kernel MIPS R5 tolerant but leaves proper MIPS R5 support to a future patchset. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/kernel/cpu-probe.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 9be68091bdf2..5465dc183e5a 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -291,6 +291,17 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c)
291 return config4 & MIPS_CONF_M; 291 return config4 & MIPS_CONF_M;
292} 292}
293 293
294static inline unsigned int decode_config5(struct cpuinfo_mips *c)
295{
296 unsigned int config5;
297
298 config5 = read_c0_config5();
299 config5 &= ~MIPS_CONF5_UFR;
300 write_c0_config5(config5);
301
302 return config5 & MIPS_CONF_M;
303}
304
294static void decode_configs(struct cpuinfo_mips *c) 305static void decode_configs(struct cpuinfo_mips *c)
295{ 306{
296 int ok; 307 int ok;
@@ -311,6 +322,8 @@ static void decode_configs(struct cpuinfo_mips *c)
311 ok = decode_config3(c); 322 ok = decode_config3(c);
312 if (ok) 323 if (ok)
313 ok = decode_config4(c); 324 ok = decode_config4(c);
325 if (ok)
326 ok = decode_config5(c);
314 327
315 mips_probe_watch_registers(c); 328 mips_probe_watch_registers(c);
316 329