Re: [PATCH 1/2] KVM: x86 emulator: put register operand write back to a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux