kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Wei Yongjun <yjwei@cn.fujitsu.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: x86 emulator: put register operand write back to a function
Date: Sun, 15 Aug 2010 14:30:13 +0300	[thread overview]
Message-ID: <4C67CFC5.6060900@redhat.com> (raw)
In-Reply-To: <4C63F947.7020808@cn.fujitsu.com>

 On 08/12/2010 04:38 PM, Wei Yongjun wrote:
> Introduce function write_register_operand() to write back the
> register operand.
>
>
>  
> +static void write_register_operand(struct operand *op, unsigned long val,
> +				   unsigned int bytes)
> +{
> +	/* The 4-byte case *is* correct: in 64-bit mode we zero-extend. */
> +	switch (bytes) {
> +	case 1:
> +		*(u8 *)op->addr.reg = (u8)val;
> +		break;
> +	case 2:
> +		*(u16 *)op->addr.reg = (u16)val;
> +		break;
> +	case 4:
> +		*op->addr.reg = (u32)val;
> +		break;	/* 64b: zero-extend */
> +	case 8:
> +		*op->addr.reg = val;
> +		break;
> +	}
> +}

It's cleaner to take val and bytes from struct operand, and do the
assignment from the callers, no?

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


  parent reply	other threads:[~2010-08-15 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12 13:38 [PATCH 1/2] KVM: x86 emulator: put register operand write back to a function Wei Yongjun
2010-08-12 13:41 ` [PATCH 2/2] KVM: x86 emulator: add XADD instruction emulation Wei Yongjun
2010-08-12 15:34   ` Paolo Bonzini
2010-08-13  5:13     ` [PATCH 2/2 v2] " Wei Yongjun
2010-08-13  5:32       ` [PATCH 2/2 v3] " Wei Yongjun
2010-08-15 11:30 ` Avi Kivity [this message]
     [not found]   ` <4C689B56.4000405@cn.fujitsu.com>
2010-08-16  8:55     ` [PATCH 1/2] KVM: x86 emulator: put register operand write back to a function 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=4C67CFC5.6060900@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=yjwei@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).