All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Mohammed Gamal <m.gamal005@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH non-atomic-injection] x86 emulator: Add cwd/cdq/cqo instruction (opcode 0x99)
Date: Sun, 22 Aug 2010 14:34:48 +0300	[thread overview]
Message-ID: <4C710B58.7090704@redhat.com> (raw)
In-Reply-To: <1282227939-4378-1-git-send-email-m.gamal005@gmail.com>

  On 08/19/2010 05:25 PM, Mohammed Gamal wrote:
> Signed-off-by: Mohammed Gamal<m.gamal005@gmail.com>
> ---
>   arch/x86/kvm/emulate.c |   16 +++++++++++++++-
>   1 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index ee4bb69..fddf76d 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -2421,7 +2421,7 @@ static struct opcode opcode_table[256] = {
>   	/* 0x90 - 0x97 */
>   	X8(D(SrcAcc | DstReg)),
>   	/* 0x98 - 0x9F */
> -	D(DstAcc | SrcNone), N, D(SrcImmFAddr | No64), N,
> +	D(DstAcc | SrcNone), D(ImplicitOps), D(SrcImmFAddr | No64), N,
>   	D(ImplicitOps | Stack), D(ImplicitOps | Stack), N, N,
>   	/* 0xA0 - 0xA7 */
>   	D(ByteOp | DstAcc | SrcMem | Mov | MemAbs), D(DstAcc | SrcMem | Mov | MemAbs),
> @@ -3161,6 +3161,20 @@ special_insn:
>   		case 8: c->dst.val = (s32)c->dst.val; break;
>   		}
>   		break;
> +	case 0x99: /* cwd/cdq/cqo */ {
> +		unsigned long rax = c->regs[VCPU_REGS_RAX];
> +		unsigned long sign_bit = 1<<  ((c->op_bytes * 8) - 1);
> +
> +		if (rax&  sign_bit) {
> +			switch (c->op_bytes) {
> +			case 2: c->regs[VCPU_REGS_RDX] = 0xffff; break;
> +			case 4: c->regs[VCPU_REGS_RDX] = 0xffffffff; break;
> +			case 8: c->regs[VCPU_REGS_RDX] = 0xffffffffffffffff; break;
> +			}
> +		} else
> +			c->regs[VCPU_REGS_RDX] = 0;
> +		}
> +		break;

Again I have something (a bit simpler) in my queue, will push it soon.  
I applied your test case.

We need to work out a way of not duplicating this work.

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


      reply	other threads:[~2010-08-22 11:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19 14:25 [PATCH non-atomic-injection] x86 emulator: Add cwd/cdq/cqo instruction (opcode 0x99) Mohammed Gamal
2010-08-22 11:34 ` Avi Kivity [this message]

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=4C710B58.7090704@redhat.com \
    --to=avi@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.