Skip to content

Commit

Permalink
i8k: Avoid lahf in 64-bit code
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reported-by: Jeff Rickman <[email protected]>
Tested-by: Jeff Rickman <[email protected]>
Tested-by: Harry G McGavran Jr <[email protected]>
Cc: [email protected]
Cc: Massimo Dal Zotto <[email protected]>
Signed-off-by: Jean Delvare <[email protected]>
  • Loading branch information
tettamanti authored and Jean Delvare committed May 25, 2011
1 parent 4a7df24 commit bc1f419
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/char/i8k.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bc1f419

Please sign in to comment.