public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: kvm@vger.kernel.org
Subject: [BUG?] can not writeback more then 8 bytes memory
Date: Fri, 20 Aug 2010 17:12:00 +0800	[thread overview]
Message-ID: <4C6E46E0.4080409@cn.fujitsu.com> (raw)

Hi all:

I have the following patch to SIDT emulation instruction, but it
does not work because we can not writeback more then 8 bytes
memory, the SIDT under PROTO64 is 10 bytes.

I change the code to write twice, first time write limit, then write
address, and it does not work too. If I change the c->dst.bytes
to only writeback 8 bytes, it will writeback 8 bytes.

Is this a bug of KVM or it is the IO limit?

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index dc3a648..43a6819 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2213,7 +2213,8 @@ static struct opcode group5[] = {
 };
 
 static struct group_dual group7 = { {
-	N, N, D(ModRM | SrcMem | Priv), D(ModRM | SrcMem | Priv),
+	N, D(DstMem | SrcNone | ModRM | Op3264),
+	D(ModRM | SrcMem | Priv), D(ModRM | SrcMem | Priv),
 	D(SrcNone | ModRM | DstMem | Mov), N,
 	D(SrcMem16 | ModRM | Mov | Priv),
 	D(SrcMem | ModRM | ByteOp | Priv | NoAccess),
@@ -3282,6 +3283,7 @@ twobyte_insn:
 		switch (c->modrm_reg) {
 			u16 size;
 			unsigned long address;
+			struct desc_ptr dt;
 
 		case 0: /* vmcall */
 			if (c->modrm_mod != 3 || c->modrm_rm != 1)
@@ -3296,6 +3298,11 @@ twobyte_insn:
 			/* Disable writeback. */
 			c->dst.type = OP_NONE;
 			break;
+		case 1: /* sidt */
+			ops->get_idt(&dt, ctxt->vcpu);
+			c->dst.bytes = c->op_bytes + 2;
+			memcpy(&c->dst.valptr, &dt, c->dst.bytes);
+			break;
 		case 2: /* lgdt */
 			rc = read_descriptor(ctxt, ops, c->src.addr.mem,
 					     &size, &address, c->op_bytes);
-- 
1.7.0.4



             reply	other threads:[~2010-08-20  9:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  9:12 Wei Yongjun [this message]
2010-08-22 10:09 ` [BUG?] can not writeback more then 8 bytes memory Avi Kivity
2010-08-23  8:55   ` Wei Yongjun
2010-08-23  9:29     ` 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=4C6E46E0.4080409@cn.fujitsu.com \
    --to=yjwei@cn.fujitsu.com \
    --cc=kvm@vger.kernel.org \
    /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