All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i8k: Avoid lahf in 64-bit code
@ 2011-05-16 19:12 Jean Delvare
  0 siblings, 0 replies; only message in thread
From: Jean Delvare @ 2011-05-16 19:12 UTC (permalink / raw)
  To: Massimo Dal Zotto; +Cc: platform-driver-x86, Andrew Morton, Luca Tettamanti

From: Luca Tettamanti <kronos.it@gmail.com>

i8k uses lahf to read the flag register in 64-bit code; early x86-64
CPUs, however, lack this instruction and we get an invalid opcode
exception at runtime.
Use pushf to load the flag register into the stack instead.

Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
Reported-by: Jeff Rickman <jrickman@myamigos.us>
Tested-by: Jeff Rickman <jrickman@myamigos.us>
Tested-by: Harry G McGavran Jr <w5pny@arrl.net>
Cc: stable@kernel.org
Cc: Massimo Dal Zotto <dz@debian.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
If nobody picks this fix quickly, I'll send it to Linus myself. I
haven't heard from Massimo for weeks if not months :(

 drivers/char/i8k.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
index d72433f..ee01716 100644
--- a/drivers/char/i8k.c
+++ b/drivers/char/i8k.c
@@ -139,8 +139,8 @@ static int i8k_smm(struct smm_regs *regs)
 		"movl %%edi,20(%%rax)\n\t"
 		"popq %%rdx\n\t"
 		"movl %%edx,0(%%rax)\n\t"
-		"lahf\n\t"
-		"shrl $8,%%eax\n\t"
+		"pushfq\n\t"
+		"popq %%rax\n\t"
 		"andl $1,%%eax\n"
 		:"=a"(rc)
 		:    "a"(regs)


-- 
Jean Delvare

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-16 19:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-16 19:12 [PATCH] i8k: Avoid lahf in 64-bit code Jean Delvare

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.