Skip to content

Commit

Permalink
lguest: workaround cmpxchg8b_emu by ignoring cli in the guest.
Browse files Browse the repository at this point in the history
It's only used by cmpxchg8b_emu (see db677ff for the gory
details), and fixing that to be paravirt aware would be more work than
simply ignoring it (and AFAICT only help lguest).  This makes lguest
work on machines which have cmpxchg8b, for kernels compiled for older
processors.

(We can't emulate it properly: the popf which expects to restore interrupts
does not trap).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: virtualization@lists.osdl.org
  • Loading branch information
Rusty Russell committed Apr 14, 2010
1 parent 2ba3abd commit 5094aea
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/lguest/x86/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,18 @@ static int emulate_insn(struct lg_cpu *cpu)
/* Decoding x86 instructions is icky. */
insn = lgread(cpu, physaddr, u8);

/*
* Around 2.6.33, the kernel started using an emulation for the
* cmpxchg8b instruction in early boot on many configurations. This
* code isn't paravirtualized, and it tries to disable interrupts.
* Ignore it, which will Mostly Work.
*/
if (insn == 0xfa) {
/* "cli", or Clear Interrupt Enable instruction. Skip it. */
cpu->regs->eip++;
return 1;
}

/*
* 0x66 is an "operand prefix". It means it's using the upper 16 bits
* of the eax register.
Expand Down

0 comments on commit 5094aea

Please sign in to comment.