1. 09 Jan, 2013 1 commit
    • Avi Kivity's avatar
      KVM: x86 emulator: framework for streamlining arithmetic opcodes · e28bbd44
      Avi Kivity authored
      We emulate arithmetic opcodes by executing a "similar" (same operation,
      different operands) on the cpu.  This ensures accurate emulation, esp. wrt.
      eflags.  However, the prologue and epilogue around the opcode is fairly long,
      consisting of a switch (for the operand size) and code to load and save the
      operands.  This is repeated for every opcode.
      
      This patch introduces an alternative way to emulate arithmetic opcodes.
      Instead of the above, we have four (three on i386) functions consisting
      of just the opcode and a ret; one for each operand size.  For example:
      
         .align 8
         em_notb:
      	not %al
      	ret
      
         .align 8
         em_notw:
      	not %ax
      	ret
      
         .align 8
         em_notl:
      	not %eax
      	ret
      
         .align 8
         em_notq:
      	not %rax
      	ret
      
      The prologue and epilogue are shared across all opcodes.  Note the functions
      use a special calling convention; notably eflags is an input/output parameter
      and is not clobbered.  Rather than dispatching the four functions through a
      jump table, the functions are declared as a constant size (8) so their address
      can be calculated.
      Acked-by: default avatarGleb Natapov <gleb@redhat.com>
      Signed-off-by: default avatarAvi Kivity <avi.kivity@gmail.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      e28bbd44
  2. 08 Jan, 2013 2 commits
  3. 07 Jan, 2013 9 commits
  4. 02 Jan, 2013 7 commits
  5. 24 Dec, 2012 1 commit
  6. 23 Dec, 2012 9 commits
  7. 18 Dec, 2012 4 commits
  8. 15 Dec, 2012 1 commit
  9. 14 Dec, 2012 6 commits