mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] BUG() disassembly tweak
@ 2002-05-10 21:22 Hugh Dickins
  2002-05-10 22:10 ` Linus Torvalds
  2002-05-13 15:31 ` Hugh Dickins
  0 siblings, 2 replies; 15+ messages in thread
From: Hugh Dickins @ 2002-05-10 21:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Marcelo Tosatti, Keith Owens, linux-kernel

Could we change the i386 BUG() macro slightly again?  Sorry to return
to this stale subject, but I'm now trying to do something constructive
about the insane disassembly issue, before 2.4.19 finalizes, and have
found that if FILE pointer and LINE short are interchanged, then ud2
instruction can be well displayed as an "Ap" instruction, like ljmp.
Whereas I've not found an instruction format that fits its current
ordering: maybe that's just my ignorance, please enlighten me if so.
Patch below against 2.5.15, applies with offset warning to 2.4.19-pre8.

Hugh

diff -urN 2.5.15/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c
--- 2.5.15/arch/i386/kernel/traps.c	Tue Apr 23 12:18:51 2002
+++ linux/arch/i386/kernel/traps.c	Fri May 10 21:56:49 2002
@@ -260,9 +260,9 @@
 		goto no_bug;
 	if (ud2 != 0x0b0f)
 		goto no_bug;
-	if (__get_user(line, (unsigned short *)(eip + 2)))
+	if (__get_user(line, (unsigned short *)(eip + 6)))
 		goto bug;
-	if (__get_user(file, (char **)(eip + 4)) ||
+	if (__get_user(file, (char **)(eip + 2)) ||
 		(unsigned long)file < PAGE_OFFSET || __get_user(c, file))
 		file = "<bad filename>";
 
diff -urN 2.5.15/include/asm-i386/page.h linux/include/asm-i386/page.h
--- 2.5.15/include/asm-i386/page.h	Wed May  8 20:42:40 2002
+++ linux/include/asm-i386/page.h	Fri May 10 21:55:44 2002
@@ -98,9 +98,9 @@
 #if 1	/* Set to zero for a slightly smaller kernel */
 #define BUG()				\
  __asm__ __volatile__(	"ud2\n"		\
-			"\t.word %c0\n"	\
-			"\t.long %c1\n"	\
-			 : : "i" (__LINE__), "i" (__FILE__))
+			"\t.long %c0\n"	\
+			"\t.word %c1\n"	\
+			 : : "i" (__FILE__), "i" (__LINE__))
 #else
 #define BUG() __asm__ __volatile__("ud2\n")
 #endif


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

end of thread, other threads:[~2002-05-13 15:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-10 21:22 [PATCH] BUG() disassembly tweak Hugh Dickins
2002-05-10 22:10 ` Linus Torvalds
2002-05-10 22:51   ` Dave Jones
2002-05-11 11:42     ` Ingo Oeser
2002-05-10 22:58   ` Andrew Morton
2002-05-11  0:00     ` Keith Owens
2002-05-11  1:58       ` Hugh Dickins
2002-05-11  2:32         ` Kai Germaschewski
2002-05-11  3:03         ` Keith Owens
2002-05-11  1:04   ` Hugh Dickins
2002-05-11  1:34     ` Keith Owens
2002-05-11  1:39       ` Keith Owens
2002-05-11  2:07       ` Hugh Dickins
2002-05-11  2:21         ` Keith Owens
2002-05-13 15:31 ` Hugh Dickins

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

all inboxes | Powered by JetHome®