]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/lguest/x86/core.c
lguest: workaround cmpxchg8b_emu by ignoring cli in the guest.
[net-next-2.6.git] / drivers / lguest / x86 / core.c
index fb2b7ef7868ef6e0126c932049122f729fab7cb1..b4eb675a807e6c71f021de8c84133bd6c26bc50b 100644 (file)
@@ -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.