* [PATCH] fix dubious segment register clear in cpu_init()
@ 2006-08-03 23:49 Jeremy Fitzhardinge
2006-08-04 0:23 ` Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Fitzhardinge @ 2006-08-03 23:49 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen; +Cc: Linux Kernel Mailing List
Fix a very dubious piece of code in
arch/i386/kernel/cpu/common.c:cpu_init(). This clears out %fs and
%gs, but clobbers %eax in the process without telling gcc. It turns
out that gcc happens to be not using %eax at that point anyway so it
doesn't matter much, but it looks like a bomb waiting to go off.
This does end up saving an instruction, because gcc wants %eax==0 for
the set_debugreg()s below.
Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
diff -r ced3124154dc arch/i386/kernel/cpu/common.c
--- a/arch/i386/kernel/cpu/common.c Mon Jul 31 18:52:19 2006 -0700
+++ b/arch/i386/kernel/cpu/common.c Thu Aug 03 16:23:02 2006 -0700
@@ -675,7 +675,7 @@ old_gdt:
#endif
/* Clear %fs and %gs. */
- asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs");
+ asm volatile ("movl %0, %%fs; movl %0, %%gs" : : "r" (0));
/* Clear all 6 debug registers: */
set_debugreg(0, 0);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-08-04 0:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-03 23:49 [PATCH] fix dubious segment register clear in cpu_init() Jeremy Fitzhardinge
2006-08-04 0:23 ` Andi Kleen
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.