public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] BUG preserve registers
@ 2002-02-09  8:13 Hugh Dickins
  2002-02-09  8:32 ` Andrew Morton
  2002-02-09 19:30 ` Linus Torvalds
  0 siblings, 2 replies; 36+ messages in thread
From: Hugh Dickins @ 2002-02-09  8:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Marcelo Tosatti, Linus Torvalds, H. Peter Anvin, linux-kernel

It's frustrating that when Verbose BUG() reporting is configured,
info gets lost: fix for i386 below.  This is your area, Andrew:
please confirm to Marcelo if you'd like him to apply this.

Example: in hpa's recent prune_dcache crash, %eax showed the length of
the kernel BUG printk, when we'd have liked to see the invalid d_count:
off-by-one or obviously corrupted?

Hugh

--- 2.4.18-pre9/arch/i386/kernel/entry.S	Thu Feb  7 14:38:06 2002
+++ linux/arch/i386/kernel/entry.S	Fri Feb  8 21:47:39 2002
@@ -132,6 +132,30 @@
 	movl $-8192, reg; \
 	andl %esp, reg
 
+#ifdef CONFIG_DEBUG_BUGVERBOSE
+BUG_format:
+	.asciz "kernel BUG at %s:%d!\n"
+ENTRY(do_BUG)
+	pushfl			# Save flags and registers changed in C
+	pushl %eax
+	pushl %ecx
+	pushl %edx
+	pushl $1
+	call SYMBOL_NAME(bust_spinlocks)
+	movl 28(%esp),%eax
+	movl 24(%esp),%ecx
+	pushl %eax
+	pushl %ecx
+	pushl $BUG_format
+	call SYMBOL_NAME(printk)
+	addl $16,%esp
+	popl %edx		# Restore registers and flags for display
+	popl %ecx
+	popl %eax
+	popfl
+	ret
+#endif /* CONFIG_DEBUG_BUGVERBOSE */
+
 ENTRY(lcall7)
 	pushfl			# We get a different stack layout with call gates,
 	pushl %eax		# which has to be cleaned up later..
--- 2.4.18-pre9/arch/i386/mm/fault.c	Thu Feb  7 14:38:07 2002
+++ linux/arch/i386/mm/fault.c	Fri Feb  8 19:06:45 2002
@@ -125,12 +125,6 @@
 	}
 }
 
-void do_BUG(const char *file, int line)
-{
-	bust_spinlocks(1);
-	printk("kernel BUG at %s:%d!\n", file, line);
-}
-
 asmlinkage void do_invalid_op(struct pt_regs *, unsigned long);
 extern unsigned long idt;
 


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2002-02-11 20:51 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-09  8:13 [PATCH] BUG preserve registers Hugh Dickins
2002-02-09  8:32 ` Andrew Morton
2002-02-09 10:33   ` Hugh Dickins
2002-02-09 19:30 ` Linus Torvalds
2002-02-09 19:34   ` Andrew Morton
2002-02-09 21:37     ` Linus Torvalds
2002-02-09 20:00       ` H. Peter Anvin
2002-02-09 21:49         ` Linus Torvalds
2002-02-09 20:24           ` H. Peter Anvin
2002-02-09 20:11       ` Andrew Morton
2002-02-09 20:15         ` Linus Torvalds
2002-02-09 22:07           ` Andrew Morton
2002-02-10  2:41             ` Alan Cox
2002-02-10  4:20               ` Andrew Morton
2002-02-10  4:23                 ` H. Peter Anvin
2002-02-10  4:28                   ` Andrew Morton
2002-02-10  6:16                 ` Linus Torvalds
2002-02-10  5:28                   ` Andrew Morton
2002-02-10  7:23                     ` Linus Torvalds
2002-02-10  6:28                       ` Andrew Morton
2002-02-10  9:05                         ` Andrew Morton
     [not found]                           ` <200202110710.g1B7A5t28328@Port.imtp.ilyichevsk.odessa.ua>
2002-02-11  7:22                             ` Andrew Morton
2002-02-11 17:19                           ` Hugh Dickins
2002-02-11 19:48                             ` Andrew Morton
2002-02-11 20:52                               ` Hugh Dickins
2002-02-10  7:13                       ` H. Peter Anvin
2002-02-10  8:53                         ` arjan
2002-02-11 15:26                     ` Jamie Lokier
2002-02-10  6:23                   ` Eric W. Biederman
2002-02-10  6:50                     ` Andrew Morton
2002-02-10 15:40                       ` Eric W. Biederman
2002-02-10  7:08                     ` Stevie O
2002-02-10 14:35                   ` Olaf Dietsche
2002-02-10  4:55               ` Linus Torvalds
2002-02-10  5:03               ` Linus Torvalds
2002-02-10  4:21       ` Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox