public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Streamline arithmetic instruction emulation
@ 2012-12-22 12:26 Avi Kivity
  2012-12-22 12:26 ` [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes Avi Kivity
                   ` (7 more replies)
  0 siblings, 8 replies; 24+ messages in thread
From: Avi Kivity @ 2012-12-22 12:26 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov; +Cc: kvm

The current arithmetic instruction emulation is fairly clumsy: after
decode, each instruction gets a switch (size), and for every size
we fetch the operands, prepare flags, emulate the instruction, then store
back the flags and operands.

This patchset simplifies things by moving everything into common code
except the instruction itself.  All the pre- and post- processing is
coded just once.  The per-instrution code looks like:

  add %bl, %al
  ret

  add %bx, %ax
  ret

  add %ebx, %eax
  ret

  add %rbx, %rax
  ret

The savings in size, for the ten instructions converted in this patchset,
are fairly large:

   text	   data	    bss	    dec	    hex	filename
  63724	      0	      0	  63724	   f8ec	arch/x86/kvm/emulate.o.before
  61268	      0	      0	  61268	   ef54	arch/x86/kvm/emulate.o.after

- around 2500 bytes.

Avi Kivity (7):
  KVM: x86 emulator: framework for streamlining arithmetic opcodes
  KVM: x86 emulator: Support for declaring single operand fastops
  KVM: x86 emulator: introduce NoWrite flag
  KVM: x86 emulator: mark CMP, CMPS, SCAS, TEST as NoWrite
  KVM: x86 emulator: convert NOT, NEG to fastop
  KVM: x86 emulator: add macros for defining 2-operand fastop emulation
  KVM: x86 emulator: convert basic ALU ops to fastop

 arch/x86/kvm/emulate.c | 215 +++++++++++++++++++++++++++----------------------
 1 file changed, 120 insertions(+), 95 deletions(-)

-- 
1.7.11.7


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2013-01-04  1:14 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-22 12:26 [PATCH 0/7] Streamline arithmetic instruction emulation Avi Kivity
2012-12-22 12:26 ` [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes Avi Kivity
2012-12-22 17:00   ` Gleb Natapov
2012-12-22 17:42     ` Avi Kivity
2012-12-22 18:01       ` Gleb Natapov
2012-12-22 18:07         ` Avi Kivity
2012-12-22 18:11           ` Gleb Natapov
2012-12-22 18:18             ` Avi Kivity
2012-12-22 18:44               ` Gleb Natapov
2012-12-22 21:55                 ` Avi Kivity
2012-12-22 12:26 ` [PATCH 2/7] KVM: x86 emulator: Support for declaring single operand fastops Avi Kivity
2012-12-22 12:26 ` [PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag Avi Kivity
2012-12-22 15:11   ` Gleb Natapov
2012-12-22 15:28     ` Avi Kivity
2012-12-22 15:39       ` Gleb Natapov
2012-12-22 15:45         ` Avi Kivity
2012-12-22 15:51           ` Avi Kivity
2012-12-22 16:20             ` Gleb Natapov
2012-12-22 12:26 ` [PATCH 4/7] KVM: x86 emulator: mark CMP, CMPS, SCAS, TEST as NoWrite Avi Kivity
2012-12-22 12:26 ` [PATCH 5/7] KVM: x86 emulator: convert NOT, NEG to fastop Avi Kivity
2012-12-22 12:26 ` [PATCH 6/7] KVM: x86 emulator: add macros for defining 2-operand fastop emulation Avi Kivity
2012-12-22 12:26 ` [PATCH 7/7] KVM: x86 emulator: convert basic ALU ops to fastop Avi Kivity
2012-12-23  9:47 ` [PATCH 0/7] Streamline arithmetic instruction emulation Gleb Natapov
     [not found]   ` <CAEbWairRO+p1Lco8NJqC99xz1EFcP6CZktOsBmt6AwW4R5vMMw@mail.gmail.com>
2013-01-04  1:14     ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox