Re: [PATCHv2] KVM: x86 emulator: fix pusha instruction emulation

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

 



On 06/15/2010 04:03 AM, Wei Yongjun wrote:
> emulate pusha instruction only writeback the last
> EDI register, but the other registers which need
> to be writeback is ignored. This patch fixed it.
>
>   

Ouch.

>  
> -static void emulate_pusha(struct x86_emulate_ctxt *ctxt,
> +static int emulate_pusha(struct x86_emulate_ctxt *ctxt,
>  			  struct x86_emulate_ops *ops)
>  {
>  	struct decode_cache *c = &ctxt->decode;
>  	unsigned long old_esp = c->regs[VCPU_REGS_RSP];
> +	int rc = X86EMUL_CONTINUE;
>  	int reg = VCPU_REGS_RAX;
>  
>  	while (reg <= VCPU_REGS_RDI) {
> @@ -1663,8 +1722,18 @@ static void emulate_pusha(struct x86_emulate_ctxt *ctxt,
>  		(c->src.val = old_esp) : (c->src.val = c->regs[reg]);
>  
>  		emulate_push(ctxt, ops);
> +
> +		rc = writeback(ctxt, ops);
> +		if (rc != X86EMUL_CONTINUE)
> +			return rc;
> +
>   

We might have partial completion if we fault on the one the second or
later register. Still, it's an improvement over what we have now.

>  		++reg;
>  	}
> +
> +	/* Disable writeback. */
> +	c->dst.type = OP_NONE;
> +
> +	return rc;
>  }
>  
>   

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