From: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
To: Mohammed Gamal <m.gamal005@gmail.com>
Cc: kvm@vger.kernel.org, avi@qumranet.com, guillaume.thouvenin@ext.bull.net
Subject: Re: [PATCH] x86 emulator: Add call near absolute instruction (group5: opcode 0xff mod r/m 2)
Date: Tue, 9 Sep 2008 09:16:22 +0200 [thread overview]
Message-ID: <20080909091622.7cbb4ff5@frecb000711> (raw)
In-Reply-To: <20080908184719.GB31824@mohd-laptop>
On Mon, 8 Sep 2008 21:47:19 +0300
Mohammed Gamal <m.gamal005@gmail.com> 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 <guillaume.thouvenin@ext.bull.net>
---
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;
next prev parent reply other threads:[~2008-09-09 7:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-08 18:47 [PATCH] x86 emulator: Add call near absolute instruction (group5: opcode 0xff mod r/m 2) Mohammed Gamal
2008-09-09 7:16 ` Guillaume Thouvenin [this message]
2008-09-09 12:49 ` Mohammed Gamal
2008-09-10 9:31 ` Guillaume Thouvenin
2008-09-09 14:51 ` Avi Kivity
2008-09-09 17:05 ` Mohammed Gamal
2008-09-10 7:29 ` Avi Kivity
2008-09-12 7:40 ` Guillaume Thouvenin
2008-09-12 10:42 ` Mohammed Gamal
2008-09-10 15:31 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080909091622.7cbb4ff5@frecb000711 \
--to=guillaume.thouvenin@ext.bull.net \
--cc=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
--cc=m.gamal005@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox