[lkml]   [2011]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[128/146] i8k: Avoid lahf in 64-bit code
2.6.38-stable review patch.  If anyone has any objections, please let us know.


From: Luca Tettamanti <>

commit bc1f419c76a2d6450413ce4349f4e4a07be011d5 upstream.

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 <>
Reported-by: Jeff Rickman <>
Tested-by: Jeff Rickman <>
Tested-by: Harry G McGavran Jr <>
Cc: Massimo Dal Zotto <>
Signed-off-by: Jean Delvare <>
Signed-off-by: Greg Kroah-Hartman <>

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

--- 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"(regs)

 \ /
  Last update: 2011-06-01 10:45    [W:0.302 / U:26.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site