Slashdot Mirror


Pointers for Developing x86 Virtualization?

josh asks: "For my next project, I've decided I want to do something related to x86 virtualization (the way VMware does it or Plex86 not Xen/Bochs/etc.) but I really don't know where to start. Googling hasn't been helpful (just look at the results if you don't believe me). Are there any resources for learning about this kind of x86 virtualization? I know virtual 8086 mode wouldn't work, but without that what advantage does something like VMware have over something like Bochs? Are there any F/OSS projects aimed at something along the lines of my thinking? Please enlighten me with any references and resources you might have. Thanks!"

17 of 41 comments (clear)

  1. Read More Slowly by mcgroarty · · Score: 5, Informative
    Reread the second paragraph of the Plex86 page you linked to -- plex86 virtualizes like VMWare. It's not an emulator. bochs and plex86 were started by the same developer, and virtualization versus emulation is the difference between the two projects.

    Go to the plex86 page you linked to and download source. That's an excellent place to start. Apart from that, boning up on the difference between user and kernel modes and getting your hands on the free Intel developers' docs on the Intel website are about as good as it gets for this kind of learning.

  2. qemu by cfallin · · Score: 2, Informative

    I find qemu to be quite excellent x86 virtualization software. It's closer to VMware than Bochs, using dynamic translation.

    1. Re:qemu by caseih · · Score: 3, Informative

      Not quite. While qemu will most likely yet gain virtualization to speed it up, qemu is definitely not what the poster is asking about. qemu is an emulator just like bochs, except that qemu employs dynamic translation of cpu instructions (and caching of said blocks of code). One mode of qemu, qemu-fast, uses a linux kernel module to allow the native OS memory manangement and paging routines. In pure emulation mode memory management is also emulated. At best qemu can yield a raw cpu speed of 1/3 the host processor. Compare this to vmware which, although it seems slow, in theory can be almost full speed in terms of cpu-bound metrics.

      I think that down the road qemu will adopt some virtualization techniques on various platforms. Obviously this would be limited to x86 on x86 or ppc on ppc. But it will be exciting to watch and follow qemu. I already run win2k in qemu on my 1.5 gHz athlon at quite a respectable speed.

    2. Re:qemu by caseih · · Score: 2, Interesting

      One of the few companies that has years of experience with dynamic recompiling emulation is ardi (www.ardi.com). Their 68k synthetic cpu was worked on for several years, achieving incredible performance, but alas, only 1/3 cpu speed on average. See http://www.ardi.com/SynPaper/node12.html.

      Now of course in theory if you had a lot of cache you could approach native cpu speeds, assuming that you always executed the same code over and over again. Caching certainly is the key to performance here, just like in CPUS. But realistically, you can't always keep every dynamic block in cache. Eventually it will be invalidated and new blocks will have to be translated. Much faster than emulation (orders of magnitude) but still not quite full host cpu speed.

      Your point about translating the assembly code is an interesting point, but fails to account for the fact that this has to happen on the fly. Thus the 1/3 bound is not theoretical, but simply a practical one. I'm sure newer techniques will come along to improve this.

    3. Re:qemu by Anonymous Coward · · Score: 2, Interesting

      Come on, that's still the old circa 1995 results they published back then -- they are quoting results on a 75MHz 486 for Chris' sake! I haven't seen any evidence that the ARDI guys have done much development in the last ten years, and I suspect they are paying their bills with other full-time jobs.

      There have been plenty of demonstrations of 75% to 100% of native performance being achieved by dynamic recompilations, by products such as the Digital FX86 and Connectix VirtualPC. The HP Dynamo research project even managed to exceed 100% efficiency by clever optimizations during the recompilation! (Of course they didn't start from uber-optimized code, but then again little real-world code has seen whole-program optimization over library or even module boundaries.)

  3. Why do you care? by hak1du · · Score: 3, Insightful

    Virtualizing the Pentium is a lot of tedious work because the Pentium just wasn't designed for it. You won't be learning much about virtualization in general, just a lot of Pentium-specific tricks. Why bother with that?

    Sooner or later, Intel is going to make the Pentium virtualizable in a more straightforward way. Until then, I'd just stick with one of the available solutions (including Plex86).

    1. Re:Why do you care? by GoRK · · Score: 2, Interesting

      Of course, they also have the option to make something else other than X86 the base architecture upon which they support virtualized X86 (and maybe if we're lucky other cores also). It would make a lot more sense to do this kind of thing on top of something new than to stuff it all in some kind of messy architecture extension as you suggested.

      Of course, this still adds to the mess either way, but it does make some sense.

      Maybe that's why Transmeta did it.

    2. Re:Why do you care? by T-Ranger · · Score: 2, Interesting
      Im neither a EE, nor do I have paticularly good "low level" programming tasks. That said, my Uni ASM course was on a IBM mainframe, and I use VMWare regularly, so I know a bit of the practical side of things.

      VMWare, in the workstation and GSX version, runs on top of a host OS. ESX is its own "OS". In the IBM world, the VM "OS" layer is very specialized and so far as I know, used for just allocating resources to VM instances... The hardware helps a lot in this case as well.

      Idea: What would be the possibility of a "Meta" PC hardware/OS platform? Possibly having zero reselblence to PCs of today, no PC compatable BIOS, N/S bridge concept gone, etc... The hardware, and a thin VM managemnt OS works together to virtualize the hardware, making it appear to be a PC to the VMed OSs.

  4. Get guides to the hardware you want to emulate by ChaseTec · · Score: 4, Informative

    Half of what you want is cpu documentation, Intel makes nice free guides to their 32 bit x86 cpus. Sometimes they even will send out the manuals free in book format, right now it looks like you can download them or order a free cd. Check back often because the free books(shipping free too) come and go. http://developer.intel.com/design/pentium4/manuals /index2.htm

    The other main half is BIOS info, check our Ralf Brown's int list: http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/p ub/WWW/files.html

    For the rest you just need lots docs about various hardware like floppy controllers and such, check out my site for OS developers since I probably have more links listed then anyone else. Besides this stuff you might want to re-include java in your google searches because most of the research into virtual machines that I've seen uses java but alot would still apply.

    --
    My Hello World is 512 bytes. But it's also a valid Fat12 boot sector, Fat12 file reader, and Pmode routine.
  5. MOL by Joe+Tennies · · Score: 3, Informative

    Something you may want to look at is MOL (maconlinux.org). It's for PPC, but it does demonstrate how to do virtual machines like you are discussing.

    Don't forget that one good thing is also your ability to write a good driver for the client OS. That can yield huge speed increases on its own.

  6. Answer by runderwo · · Score: 4, Funny
    Pointers for Developing x86 Virtualization?
    Yes, I would strongly recommend their use.

  7. virtualization wiki by johnseq · · Score: 2, Informative
    I maintain a wiki on virtualization projects which has several oss listed

    this page has all the open source wiki pages, and this is the front page for the site.

  8. Not restricting to x86... by hubertf · · Score: 3, Informative

    here are a few links from my collection on the topic:

    + vmware
    + bochs
    + vax with simh-vax, see
    http://www.netbsd.org/Ports/vax/emulator-howto.htm l
    + xen
    (http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)
    + LilyVM
    (http://lilyvm.sourceforge.net/index.ja.html)
    + mips64emul
    (http://www.mdstud.chalmers.se/~md1gavan/mips64emu l/),
    + dosbox (http://dosbox.sf.net)

    I'm mostly interested with running non-Linux (e.g. NetBSD, Solaris) in a virtual environment for using it in my "Virtual Unix Lab" training environment, see http://www.feyrer.de/vulab/).

    - Hubert

  9. Suggestion by curator_thew · · Score: 2, Interesting


    Fantastic idea, I would suggest you look at the L4Ka and related projects (http://l4ka.org/projects/hazelnut/).

    Please do not create a new project from scratch: there are enough.

    What is needed though is adapting existing operating systems (e.g. Linux, BSD, etc) to work in these virtualised environments. Further to this, also supporting co-ooperative virtualise environments.

    Your efforts in this area would be very well looked upon.

  10. Check out Qemu - the Quick Emulator by Nailer · · Score: 2, Informative

    If you want a real Open Source emulator that's complete enough to run Windows XP (and do so with usable speed), QEmu is your only option. Currently it simulates a Pentium, Vesa fgramebuffer video card, and ISA NE2000 NIC.

    Check out this dude's blog for screenshots of QEmu running Win2K.

    Combine it with a copy of x86 glibc and a recent Crossover, you can use it to run Office XP for Windows on Linux on a Mac. Scary :^).

    Go get it from the Qemu Site.

  11. Re:Link by vinit79 · · Score: 2, Informative

    The acm portal does have a wealth of information but u need to pay for the subscription to access most papers(unless as in my case u r a student and ur univ library has a subscription) . However, one good idea is to find the relevant papers and then google for them( many authors often maintain a copy of their papers on their webpages .. albiet somewhat illegally)

  12. Re:Link by addaon · · Score: 2, Informative

    It is legal for the author to make a copy of their paper available free of charge, although the ACM (and other professional organizations) discourage it. The author is the copyright holder.

    --

    I've had this sig for three days.