On Mon, 8 Sep 2008 21:47:19 +0300
Mohammed Gamal <[EMAIL PROTECTED]> wrote:
> + SrcMem | ModRM | Stack, 0,
Are you sure about this? In Xen they use "DstMem | SrcNone | ModRM"
Anyway I tested the patch and the next problem is with the following
instruction:
emulation failed (emulation failure) rip 4423e 3c 25 0f 84
Thus I added the following patch (see the end of this email) and now
another problem:
emulation failed (mmio) rip 44b5b 03 84 c0 75
So it's not the same problem. I'm trying to fix that. It would be cool
to be able to boot a distribution with emulate_invalid_guest_state enabled ;)
Signed-off-by: Guillaume Thouvenin <[EMAIL PROTECTED]>
---
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index 30b93ee..b65bc94 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -107,7 +107,7 @@ static u16 opcode_table[256] = {
/* 0x38 - 0x3F */
ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
- 0, 0, 0, 0,
+ ByteOp | DstReg |SrcImm, DstReg|SrcImm, 0, 0,
/* 0x40 - 0x47 */
DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg,
/* 0x48 - 0x4F */
@@ -1405,10 +1405,22 @@ special_insn:
xor: /* xor */
emulate_2op_SrcV("xor", c->src, c->dst, ctxt->eflags);
break;
- case 0x38 ... 0x3d:
+ case 0x38 ... 0x3b:
cmp: /* cmp */
emulate_2op_SrcV("cmp", c->src, c->dst, ctxt->eflags);
break;
+ case 0x3c ... 0x3d: /* cmp al imm8 or ax imm16 or eax imm32 */
+ c->dst.type = OP_REG;
+ c->dst.bytes = c->op_bytes;
+ c->dst.ptr = &c->regs[VCPU_REGS_RAX];
+ if (c->op_bytes == 1)
+ c->dst.val = *(u8 *)c->dst.ptr;
+ else if (c->op_bytes == 2)
+ c->dst.val = *(u16 *)c->dst.ptr;
+ else
+ c->dst.val = *(u32 *)c->dst.ptr;
+ c->dst.orig_val = c->dst.val;
+ goto cmp;
case 0x40 ... 0x47: /* inc r16/r32 */
emulate_1op("inc", c->dst, ctxt->eflags);
break;
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html