public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: x86 emulator: Add decoding of 16bit second in memory argument
Date: Thu, 25 Feb 2010 15:40:36 +0200	[thread overview]
Message-ID: <4B867DD4.1060205@redhat.com> (raw)
In-Reply-To: <1267007307-11276-1-git-send-email-gleb@redhat.com>

On 02/24/2010 12:28 PM, Gleb Natapov wrote:
> Add decoding of Ep type of argument used by callf/jmpf.
>
> Signed-off-by: Gleb Natapov<gleb@redhat.com>
> ---
>   arch/x86/kvm/emulate.c |   16 ++++++++++++++++
>   1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index c9f604b..d288107 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -85,6 +85,7 @@
>   #define Src2ImmByte (2<<29)
>   #define Src2One     (3<<29)
>   #define Src2Imm16   (4<<29)
> +#define Src2Mem16   (5<<29)
>   #define Src2Mask    (7<<29)
>
>   enum {
> @@ -1163,6 +1164,10 @@ done_prefixes:
>   		c->src2.bytes = 1;
>   		c->src2.val = 1;
>   		break;
> +	case Src2Mem16:
> +		c->src2.bytes = 2;
> +		c->src2.type = OP_MEM;
> +		break;
>   	}
>
>   	/* Decode and fetch the destination operand: register or memory. */
> @@ -1881,6 +1886,17 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
>   		c->src.orig_val = c->src.val;
>   	}
>
> +	if (c->src2.type == OP_MEM) {
> +		c->src2.ptr = (unsigned long *)(memop + c->src.bytes);
> +		c->src2.val = 0;
> +		rc = ops->read_emulated((unsigned long)c->src2.ptr,
> +					&c->src2.val,
> +					c->src2.bytes,
> +					ctxt->vcpu);
> +		if (rc != X86EMUL_CONTINUE)
> +			goto done;
> +	}
> +
>    

This introduces a dependency between src and src2.  The alternative is 
to have an offset+segment operand type, but that introduces all types of 
complications, so I guess the dependency is worth it.  But at least 
document it when you define Src2Mem16.

-- 
error compiling committee.c: too many arguments to function


  parent reply	other threads:[~2010-02-25 13:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 10:28 [PATCH 1/2] KVM: x86 emulator: Add decoding of 16bit second in memory argument Gleb Natapov
2010-02-24 10:28 ` [PATCH 2/2] KVM: x86 emulator: Implement jmp far opcode ff/5 Gleb Natapov
2010-02-25 13:40 ` Avi Kivity [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-25 14:36 [PATCH 1/2] KVM: x86 emulator: Add decoding of 16bit second in memory argument Gleb Natapov
2010-02-25 14:38 ` 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=4B867DD4.1060205@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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