[PATCH] i8k: Tell gcc that *regs gets clobbered
From: Jim Bos
Date: Sat Nov 13 2010 - 06:14:20 EST
More recent GCC caused the i8k driver to stop working, on Slackware
compiler was upgraded from gcc-4.4.4 to gcc-4.5.1 after which it
didn't work anymore, meaning the driver didn't load or gave total
nonsensical output.
As it turned out the asm(..) statement forgot to mention it modifies
the *regs variable.
Credits to Andi Kleen <andi@xxxxxxxxxxxxxx> and Andreas Schwab
<schwab@xxxxxxxxxxxxxx> for providing the fix.
Signed-off-by: Jim Bos <jim876@xxxxxxxxx>
--- linux-2.6.36/drivers/char/i8k.c.ORIG 2010-08-02 17:20:46.000000000 +0200
+++ linux-2.6.36/drivers/char/i8k.c 2010-11-13 11:35:11.000000000 +0100
@@ -141,7 +141,7 @@
"lahf\n\t"
"shrl $8,%%eax\n\t"
"andl $1,%%eax\n"
- :"=a"(rc)
+ :"=a"(rc), "+m" (*regs)
: "a"(regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
#else
@@ -166,7 +166,8 @@
"movl %%edx,0(%%eax)\n\t"
"lahf\n\t"
"shrl $8,%%eax\n\t"
- "andl $1,%%eax\n":"=a"(rc)
+ "andl $1,%%eax\n"
+ :"=a"(rc), "+m" (*regs)
: "a"(regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
#endif