[parisc-linux-cvs] linux-2.4 tausq

Randolph Chung Randolph Chung <tausq@debian.org>
Tue, 23 Sep 2003 13:24:26 -0700


In reference to a message from Randolph Chung, dated Sep 23:
> CVSROOT:	/var/cvs
> Module name:	linux-2.4
> Changes by:	tausq	03/09/23 14:15:33
> 
> Modified files:
> 	.              : Makefile 
> 	arch/parisc/kernel: unaligned.c 
> 
> Log message:
> 2.4.22-pa9
> fix unaligned printk pacing and don't let unaligned_enabled=0 crash the kernel


Index: arch/parisc/kernel/unaligned.c
===================================================================
RCS file: /var/cvs/linux-2.4/arch/parisc/kernel/unaligned.c,v
retrieving revision 1.20
diff -u -p -r1.20 unaligned.c
--- arch/parisc/kernel/unaligned.c	25 Aug 2003 18:34:36 -0000	1.20
+++ arch/parisc/kernel/unaligned.c	23 Sep 2003 20:14:08 -0000
@@ -369,8 +369,8 @@ static int emulate_std(struct pt_regs *r
 
 void handle_unaligned(struct pt_regs *regs)
 {
-	unsigned long unaligned_count = 0;
-	unsigned long last_time = 0;
+	static unsigned long unaligned_count = 0;
+	static unsigned long last_time = 0;
         unsigned long newbase = R1(regs->iir)?regs->gr[R1(regs->iir)]:0;
 	int modify = 0;
 	int ret = -1;
@@ -380,7 +380,6 @@ void handle_unaligned(struct pt_regs *re
 	/* if the unaligned access is inside the kernel:
 	 *   if the access is caused by a syscall, then we fault the calling
 	 *     user process
-	 *   otherwise we halt the kernel
 	 */
 	if (!user_mode(regs))
 	{
@@ -427,10 +426,10 @@ void handle_unaligned(struct pt_regs *re
 			show_regs(regs);
 #endif		
 		}
-	}
 
-	if (!unaligned_enabled)
-		goto force_sigbus;
+		if (!unaligned_enabled)
+			goto force_sigbus;
+	}
 
 	/* handle modification - OK, it's ugly, see the instruction manual */
 	switch (MAJOR_OP(regs->iir))