Re: [PATCH] KVM: x86 emulator: access GPRs on demand

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

 



On Tue, Aug 07, 2012 at 06:23:01PM -0300, Marcelo Tosatti wrote:
> On Thu, Jul 19, 2012 at 03:14:38PM +0300, Avi Kivity wrote:
> > Instead of populating the the entire register file, read in registers
> > as they are accessed, and write back only the modified ones.  This
> > saves a VMREAD and VMWRITE on Intel (for rsp, since it is not usually
> > used during emulation), and a two 128-byte copies for the registers.
> > 
> > Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
> > ---
> >  arch/x86/include/asm/kvm_emulate.h |  17 ++-
> >  arch/x86/kvm/emulate.c             | 268 +++++++++++++++++++++----------------
> >  arch/x86/kvm/x86.c                 |  50 ++++---
> >  3 files changed, 192 insertions(+), 143 deletions(-)
> > 
> > diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
> > index c764f43..2f1da16 100644
> > --- a/arch/x86/include/asm/kvm_emulate.h
> > +++ b/arch/x86/include/asm/kvm_emulate.h
> > @@ -86,6 +86,19 @@ struct x86_instruction_info {
> >  
> >  struct x86_emulate_ops {
> >  	/*
> > +	 * read_gpr: read a general purpose register (rax - r15)
> > +	 *
> > +	 * @reg: gpr number.
> > +	 */
> > +	ulong (*read_gpr)(struct x86_emulate_ctxt *ctxt, unsigned reg);
> > +	/*
> > +	 * write_gpr: write a general purpose register (rax - r15)
> > +	 *
> > +	 * @reg: gpr number.
> > +	 * @val: value to write.
> > +	 */
> > +	void (*write_gpr)(struct x86_emulate_ctxt *ctxt, unsigned reg, ulong val);
> > +	/*
> >  	 * read_std: Read bytes of standard (non-emulated/special) memory.
> >  	 *           Used for descriptor reading.
> >  	 *  @addr:  [IN ] Linear address from which to read.
> > @@ -281,8 +294,10 @@ struct x86_emulate_ctxt {
> >  	bool rip_relative;
> >  	unsigned long _eip;
> >  	struct operand memop;
> > +	u32 regs_valid;  /* bitmaps of registers in _regs[] that can be read */
> > +	u32 regs_dirty;  /* bitmaps of registers in _regs[] that have been written */
> 
> emul_regs_dirty (to avoid with the other regs_dirty).

avoid confusion.


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