aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2013-03-14 13:49:26 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-04-11 09:39:51 -0400
commit1186e4e904839955e5d2be94f50e0a363cb5651b (patch)
treed27e3c3d9ee05b5c9afb18dcfbfb7522060b5280 /arch/mips/kernel
parent02b849f7613003fe5f9e58bf233d49b0ebd4a5e8 (diff)
MIPS: Avoid overoptimization by GCC.
Without this, it's possible that LTO will discard the calls to set_except_vector() in the probe for the DADDI overflow bug resulting in a kernel crash like this: [...] Mount-cache hash table entries: 256 Checking for the daddi bug... Integer overflow[#1]: Cpu 0 $ 0 : 0000000000000000 0000000010008ce1 0000000000000001 0000000000000000 $ 4 : 7fffffffffffedcd ffffffff81410000 0000000000000030 000000000000003f [...] There are other similar places in the kernel so we've just been lucky that GCC's been tolerant. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/traps.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 165b4f0bb7db..feb42c072384 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1390,9 +1390,8 @@ unsigned long vi_handlers[64];
1390void __init *set_except_vector(int n, void *addr) 1390void __init *set_except_vector(int n, void *addr)
1391{ 1391{
1392 unsigned long handler = (unsigned long) addr; 1392 unsigned long handler = (unsigned long) addr;
1393 unsigned long old_handler = exception_handlers[n]; 1393 unsigned long old_handler = xchg(&exception_handlers[n], handler);
1394 1394
1395 exception_handlers[n] = handler;
1396 if (n == 0 && cpu_has_divec) { 1395 if (n == 0 && cpu_has_divec) {
1397 unsigned long jump_mask = ~((1 << 28) - 1); 1396 unsigned long jump_mask = ~((1 << 28) - 1);
1398 u32 *buf = (u32 *)(ebase + 0x200); 1397 u32 *buf = (u32 *)(ebase + 0x200);