aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/cpu/common.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2006-09-26 10:52:34 +0200
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 10:52:34 +0200
commit5758d5dfef1c514200bda3f29ba700f1c3e3bc99 (patch)
tree7d2c859f875d0d5f1eacfbec66d4a9259aaa4893 /arch/i386/kernel/cpu/common.c
parent[PATCH] Don't force frame pointers for lockdep (diff)
downloadlinux-dev-5758d5dfef1c514200bda3f29ba700f1c3e3bc99.tar.xz
linux-dev-5758d5dfef1c514200bda3f29ba700f1c3e3bc99.zip
[PATCH] i386: fix dubious segment register clear in cpu_init()
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> Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386/kernel/cpu/common.c')
-rw-r--r--arch/i386/kernel/cpu/common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 70c87de582c7..730a7ab75009 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -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);