All of lore.kernel.org
 help / color / mirror / Atom feed
* MIPS16 patch in unaligned.c
@ 2002-12-04 12:53 Carsten Langgaard
  0 siblings, 0 replies; only message in thread
From: Carsten Langgaard @ 2002-12-04 12:53 UTC (permalink / raw)
  To: Ralf Baechle, linux-mips

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]

The attached patch make sure we don't try to emulate load and stores,
when running in MIPS16 mode on CPUs, which support MIPS16.
Without this patch the kernel crashes, if running something nasty like
crashme on a CPU, which support MIPS16.

/Carsten


--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com



[-- Attachment #2: mips16.patch --]
[-- Type: text/plain, Size: 1551 bytes --]

Index: arch/mips/kernel/unaligned.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/unaligned.c,v
retrieving revision 1.15.2.7
diff -u -r1.15.2.7 unaligned.c
--- arch/mips/kernel/unaligned.c	7 Nov 2002 23:50:11 -0000	1.15.2.7
+++ arch/mips/kernel/unaligned.c	4 Dec 2002 12:37:38 -0000
@@ -494,10 +494,10 @@
 
 	/*
 	 * Did we catch a fault trying to load an instruction?
-	 * This also catches attempts to activate MIPS16 code on
-	 * CPUs which don't support it.
+	 * Or are we running in MIPS16 mode?
 	 */
-	if (regs->cp0_badvaddr == regs->cp0_epc)
+	if ((regs->cp0_badvaddr == regs->cp0_epc) ||
+	    (regs->cp0_epc & 0x1))
 		goto sigbus;
 
 	pc = regs->cp0_epc + ((regs->cp0_cause & CAUSEF_BD) ? 4 : 0);
Index: arch/mips64/kernel/unaligned.c
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/unaligned.c,v
retrieving revision 1.6.2.6
diff -u -r1.6.2.6 unaligned.c
--- arch/mips64/kernel/unaligned.c	7 Nov 2002 23:50:11 -0000	1.6.2.6
+++ arch/mips64/kernel/unaligned.c	4 Dec 2002 12:37:40 -0000
@@ -494,10 +494,10 @@
 
 	/*
 	 * Did we catch a fault trying to load an instruction?
-	 * This also catches attempts to activate MIPS16 code on
-	 * CPUs which don't support it.
+	 * Or are we running in MIPS16 mode?
 	 */
-	if (regs->cp0_badvaddr == regs->cp0_epc)
+	if ((regs->cp0_badvaddr == regs->cp0_epc) ||
+	    (regs->cp0_epc & 0x1))
 		goto sigbus;
 
 	pc = regs->cp0_epc + ((regs->cp0_cause & CAUSEF_BD) ? 4 : 0);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-04 12:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-04 12:53 MIPS16 patch in unaligned.c Carsten Langgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.