Re: [PATCHv4 4/5] KVM: emulator: make linearize() callable from outside of emulator

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

 



On 07/19/2012 10:40 AM, Gleb Natapov wrote:
> The function will be used outside of the emulator.
> 
> Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx>
> ---
>  arch/x86/include/asm/kvm_emulate.h |   16 +++++
>  arch/x86/kvm/emulate.c             |  114 ++++++++++++++++++++----------------
>  2 files changed, 79 insertions(+), 51 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
> index 7c276ca..9ce651b 100644
> --- a/arch/x86/include/asm/kvm_emulate.h
> +++ b/arch/x86/include/asm/kvm_emulate.h
> @@ -374,6 +374,21 @@ enum x86_intercept {
>  	nr_x86_intercepts
>  };
>  
> +struct x86_linearize_params
> +{
> +	enum x86emul_mode mode;
> +	ulong ea;
> +	unsigned size;
> +	unsigned seg;
> +	struct desc_struct desc;
> +	u16 sel;
> +	bool usable;
> +	bool write;
> +	bool fetch;
> +	u8 ad_bytes;
> +	unsigned cpl;
> +};
> +
> @@ -470,14 +470,6 @@ static void set_seg_override(struct x86_emulate_ctxt *ctxt, int seg)
>  	ctxt->seg_override = seg;
>  }
>  
> -static unsigned long seg_base(struct x86_emulate_ctxt *ctxt, int seg)
> -{
> -	if (ctxt->mode == X86EMUL_MODE_PROT64 && seg < VCPU_SREG_FS)
> -		return 0;
> -
> -	return ctxt->ops->get_cached_segment_base(ctxt, seg);
> -}
> -

> +int x86_linearize(struct x86_linearize_params *p, ulong *linear)
>  {
> -	struct desc_struct desc;
> -	bool usable;
>  	ulong la;
>  	u32 lim;
> -	u16 sel;
>  	unsigned cpl, rpl;
>  
> -	la = seg_base(ctxt, addr.seg) + addr.ea;
> -	switch (ctxt->mode) {
> +	la = get_desc_base(&p->desc) + p->ea;

This makes 64-bit mode slower, since before the patch it avoided reading
the segment base for non-fs/gs segments, and only read the segment base
for fs/gs.  After the patch we always execute 4 VMREADs (and decode the
results).


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