[Discuss] VMWare Player question

Richard Pieri richard.pieri at gmail.com
Thu Oct 20 17:23:08 EDT 2011


On Oct 20, 2011, at 12:52 PM, Bill Bogstad wrote:
> 
> Instructions that accessed hardware and other specialized instructions
> were either trapped or replaced in line by calls to vmware code.

Look up trap-and-emulate, and then look at why the x86 can't do it.  I'll wait.

Now read this, specifically section 3.2 "Simple binary translation" and 3.3 "Adaptive binary translation".  The paper is about performance between different virtualization techniques on the same hardware but it covers the relevant point.  I'll wait.
http://www.vmware.com/pdf/asplos235_adams.pdf

This is the x86 emulator of which I've written.  The only way that the vmkernel can trap these instructions is with an emulator because the real CPU won't generate the necessary signals.  Instead, the application will crash and burn, and possibly take out other guests with it.

It is technically accurate to call this an x86 interpreter (which Adams and Alegsen do).  This interpreter reads x86 instructions.  Problematic instructions are converted to non-problematic instructions on the fly.  Instructions, both modified and unmodified, are then executed on the real CPU.  The technique is also used by video game console emulators.  It's called "dynamic recompilation" or "dynarec" in those circles.  The idea is that instead of fully emulating, say, a PlayStation's MIPS R3000 on a Windows box, the "emulator" converts MIPS R3000 instructions into x86 instructions on the fly.  It's a significantly faster emulation technique than emulating the full CPU.  QEMU does precisely the same thing for translating x86 instructions to host native instructions on the fly.  VMware does nothing especially different.  It simply has the benefit of emulating x86 on x86 so most instructions are just passed through to the real CPU -- the "high-performance" mentioned in the literature.  It's still slower than running natively because every instruction needs to be examined first.

VMware could have incorporated the 64-bit instructions and addressing into the binary translator.  This would have permitted 64-bit guests on 32-bit hosts.  This would have been horribly slow, as I previously mentioned.


> Full emulation of a baroque architecture like the x86 would have been
> incredibly slow.  This web page

Look at Connectix VirtualPC (prior to Microsoft's acquisition).

--Rich P.




More information about the Discuss mailing list