Re: [PATCHv2] KVM: x86 emulator: cleanup for BitOp instruction emulation

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

 



On 08/04/2010 11:37 AM, Wei Yongjun wrote:
> Signed-off-by: Wei Yongjun<yjwei@xxxxxxxxxxxxxx>
> ---
>   arch/x86/kvm/emulate.c |   12 ++++--------
>   1 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index eba5a67..74008ed 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -2617,6 +2617,10 @@ done_prefixes:
>   		return 0;
>   	}
> 
> +	/* Only subword offset for BitOp: bt/bts/btr/btc. */
> +	if (c->d&  BitOp)
> +		c->src.val&= (c->dst.bytes<<  3) - 1;
> +
>   done:
>   	return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
>   }
> @@ -3303,8 +3307,6 @@ twobyte_insn:
>   	case 0xa3:
>   	      bt:		/* bt */
>   		c->dst.type = OP_NONE;
> -		/* only subword offset */
> -		c->src.val&= (c->dst.bytes<<  3) - 1;
>   		emulate_2op_SrcV_nobyte("bt", c->src, c->dst, ctxt->eflags);
>   		break;
>   	case 0xa4: /* shld imm8, r, r/m */
> @@ -3321,8 +3323,6 @@ twobyte_insn:
>   		break;
>   	case 0xab:
>   	      bts:		/* bts */
> -		/* only subword offset */
> -		c->src.val&= (c->dst.bytes<<  3) - 1;
>   		emulate_2op_SrcV_nobyte("bts", c->src, c->dst, ctxt->eflags);
>   		break;
>   	case 0xac: /* shrd imm8, r, r/m */
> @@ -3350,8 +3350,6 @@ twobyte_insn:
>   		break;
>   	case 0xb3:
>   	      btr:		/* btr */
> -		/* only subword offset */
> -		c->src.val&= (c->dst.bytes<<  3) - 1;
>   		emulate_2op_SrcV_nobyte("btr", c->src, c->dst, ctxt->eflags);
>   		break;
>   	case 0xb6 ... 0xb7:	/* movzx */
> @@ -3373,8 +3371,6 @@ twobyte_insn:
>   		break;
>   	case 0xbb:
>   	      btc:		/* btc */
> -		/* only subword offset */
> -		c->src.val&= (c->dst.bytes<<  3) - 1;
>   		emulate_2op_SrcV_nobyte("btc", c->src, c->dst, ctxt->eflags);
>   		break;
>   	case 0xbe ... 0xbf:	/* movsx */

This has to be squashed with "fix group 8 instruction decoding" for
bisectability.  Also, please provide testcases that pass before, fail
with v1 of your patches, and pass with the final version.

Paolo
--
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