]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
MIPS: Disable usermode switching of the FR bit for MIPS R5 CPUs.
authorRalf Baechle <ralf@linux-mips.org>
Thu, 19 Sep 2013 09:15:49 +0000 (11:15 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 19 Sep 2013 09:23:10 +0000 (11:23 +0200)
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>
arch/mips/kernel/cpu-probe.c

index 9be68091bdf2b935f69ddb1223fd6fd8cdb967b7..5465dc183e5ac4d26e36d300b1df36fb4cf4d2b5 100644 (file)
@@ -291,6 +291,17 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c)
        return config4 & MIPS_CONF_M;
 }
 
+static inline unsigned int decode_config5(struct cpuinfo_mips *c)
+{
+       unsigned int config5;
+
+       config5 = read_c0_config5();
+       config5 &= ~MIPS_CONF5_UFR;
+       write_c0_config5(config5);
+
+       return config5 & MIPS_CONF_M;
+}
+
 static void decode_configs(struct cpuinfo_mips *c)
 {
        int ok;
@@ -311,6 +322,8 @@ static void decode_configs(struct cpuinfo_mips *c)
                ok = decode_config3(c);
        if (ok)
                ok = decode_config4(c);
+       if (ok)
+               ok = decode_config5(c);
 
        mips_probe_watch_registers(c);