Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Operating Systems Programming Software IT Technology

Pointers for Developing x86 Virtualization? 41

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!"
This discussion has been archived. No new comments can be posted.

Pointers for Developing x86 Virtualization?

Comments Filter:
  • Read More Slowly (Score:5, Informative)

    by mcgroarty ( 633843 ) <brian@mcgroarty.gmail@com> on Saturday May 08, 2004 @12:54AM (#9091672) Homepage
    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.

    • plex86 only runs Linux under its VM. I assumed that the implementation for something like this is different from the implementation of a full x86 VM monitor. Is the code similar enough to warrant perusal, or will it just hopelessly confuse me even more? Thanks for your help! -- Josh
      • by Anonymous Coward

        plex86 only runs Linux under its VM. I assumed that the implementation for something like this is different from the implementation of a full x86 VM monitor. Is the code similar enough to warrant perusal, or will it just hopelessly confuse me even more? Thanks for your help! -- Josh

        Plex86 is essentially a full x86 virtualization, with the exception of a few difficult corner cases that were easier to avoid (by patching the guest Linux kernel) than emulate. The same modifications could be made for any Free

    • 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 [grack.com] 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 [qemu.org].
  • qemu (Score:3, Informative)

    by cfallin ( 596080 ) on Saturday May 08, 2004 @01:20AM (#9091737) Homepage
    I find qemu [bellard.free.fr] to be quite excellent x86 virtualization software. It's closer to VMware than Bochs, using dynamic translation.
    • Re:qemu (Score:4, Informative)

      by caseih ( 160668 ) on Saturday May 08, 2004 @02:15AM (#9091881)
      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.
      • one of qemu's goals is to do x86 to ppc code translation for projects like darwine. i'm not sure that your last statement is entirely true.
      • Ok, I'll bite...

        How do you figure that a dynamic translator like QEMU is bounded to 1/3 the speed of the host processor? If you are dynamically translating code, you could theoretically get 100% efficiency after the initial translation hit. And if you load pre-translated code you can close the gap by a lot. Few people would count load time anyway.

        The only place there is a ceiling is on the guest OS dynamically generating code, in which case you have to emulate. But I imagine there are few places in most O
        • Re:qemu (Score:3, Interesting)

          by caseih ( 160668 )
          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 [ardi.com].

          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 i
          • Re:qemu (Score:2, Interesting)

            by Anonymous Coward
            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 proje
      • You've been reading - or worse, writing - too much patents lately. The word "said" is a dead giveaway.
      • One correction here: qemu-fast doesn't require a kernel module, but it does require a change to a kernel constant. Basically, you have to adjust the kernel so it expects to be loaded to a different location in memory when it starts. Another neat feature of Qemu is that you can point it at a linux kernel file, and it will load it at the right place in (emulated) memory, then begin executing, thus skipping the emulated PC BIOS.

        One thing not to forget is that Qemu wants to be a portable project and emulate

  • by addaon ( 41825 )
    Here's a link [acm.org] that should have more than enough information to get you started.
    • Re:Link (Score:3, Informative)

      by vinit79 ( 740464 )
      The acm portal [acm.org] 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)
      • Re:Link (Score:3, Informative)

        by addaon ( 41825 )
        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.
  • Why do you care? (Score:4, Insightful)

    by hak1du ( 761835 ) on Saturday May 08, 2004 @01:30AM (#9091761) Journal
    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).
    • Intel will never make the pentium virtualizable. That would require that they break backwards compatibility and produce a processor spec that is not a kludge wrapped within a kludge stuck in a 200 stage pipeline.

      I'm not a fanboy for any processor. I don't build 'em or write assembly most of the time, but the x86 architecture is a mess.
      • Re:Why do you care? (Score:3, Interesting)

        by GoRK ( 10018 )
        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.
      • AMD had an opportunity to add easy virtualization at least in some modes when they introduced the AMD64 instructions. But unfortunately I don't think they did, did they?

      • Intel will never make the pentium virtualizable. That would require that they break backwards compatibility and produce a processor spec that is not a kludge wrapped within a kludge stuck in a 200 stage pipeline.

        I don't see why it requires breaking backwards compatibility. It may be a lot of work, given what a mess the Pentium is, but Intel can do it.

        I suspect they don't want to--better to sell more real processors--but eventually, they won't have a choice.
      • Re:Why do you care? (Score:3, Interesting)

        by T-Ranger ( 10520 )
        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 possibili

  • Which way do you not want to do it? Given that Xen and Plex86 both run Linux, they are good enough. So it's not a completely plain vanilla x86 Linux, but once AMD gets support in and Linux gets ported to that, it will be. AMD is working on some improvements to AMD64 for that. x86 isn't very good for virtualization because the hardware isn't designed for it. It's too difficult to partition the resources.

    PS. They usually work by running user level code as is, and reflecting system calls to ring 1 where the

    • by Anonymous Coward
      Your blog is great -- from Windows Virgin to Visual J++ Developer in two weeks. Micro$uck ueber alles!
      • ...why people really fear Internet Exploder. Hint: it's not the missing tabs.

        BTW, Con Zymaris listed out (on the OSIA list) some of the bet-your-company-on-this technologies which Microsoft has abandoned (who remembers Blackbird? How about DNA, the Distributed Network Architecture?), and more systems which Microsoft has sucked people into and then changed, requiring significant code rewrites (e.g. VB4 and again at VB7). It's a long and impressive list.

        Bearing this in mind, and that Visual J++ is already w

        • > Visual J++ is already way past "dead meat" stage

          It's a nice fast Java IDE, though. As long as you stay away from the RNI/JDirect "lots of comments that get magically transformed into native method invocations" stuff, it's pretty cool.
    • Accordining to noted troll Christopher Anthony, Windows NT is not portable! Administrators still running NT on Alpha are understandably shocked.

      Windows NT was designed with a hardware abstraction layer to seperate machine dependent code from the rest of the code base. Windows NT 4.0 was launched on x86, Alpha, MIPS, and PowerPC. So much for not portable.
  • by ChaseTec ( 447725 ) <chase@osdev.org> on Saturday May 08, 2004 @02:47AM (#9091980) Homepage
    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 [intel.com]

    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 [cmu.edu]

    For the rest you just need lots docs about various hardware like floppy controllers and such, check out my site [osdev.org] 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.

  • MOL (Score:3, Informative)

    by Joe Tennies ( 564856 ) on Saturday May 08, 2004 @02:55AM (#9092005) Homepage
    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.
  • Answer (Score:5, Funny)

    by runderwo ( 609077 ) <runderwo@mail.wi ... rg minus painter> on Saturday May 08, 2004 @03:02AM (#9092025)
    Pointers for Developing x86 Virtualization?
    Yes, I would strongly recommend their use.

  • virtualization wiki (Score:2, Informative)

    by johnseq ( 68966 )
    I maintain a wiki on virtualization projects which has several oss listed

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

  • by hubertf ( 124995 ) on Saturday May 08, 2004 @07:37AM (#9092528) Homepage Journal
    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
  • Suggestion (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.

  • Thanks for everyone's insightful, interesting, and on-topic posts. To address some questions that were posed...
    "Why are you doing this?"
    Because I want to learn more about how the x86 works, and I want to provide something that doesn't yet exist.
    "The Pentium is not virtualizable. You won't learn about virtualization in general, you'll learn about the Pentium."
    Great! :-)
    "Don't make a new project. Work on XYZ."
    I don't know anything about the internals of other projects, and I want to do something unique

"What man has done, man can aspire to do." -- Jerry Pournelle, about space flight

Working...