All Topics  
QEMU

 

 

 

 

 

QEMU


 
 


QEMU is a processorCentral processing unit

A central processing unit , or sometimes simply processor, is the component in a digital computer that interprets ins...
 emulatorEmulator

A software emulator allows computer programs to run on a platform other than the one for which they were originally written...
 that relies on dynamic binary translationBinary translation

In computing, binary translation is the emulation of one instruction set by another through translation of code....
 to achieve a reasonable speed while being easy to port on new host CPU architectures.
In conjunction with CPU emulation, it also provides a set of device models, allowing it to run a variety of unmodified guest operating systemFacts About Operating system

An operating system is a software program that manages the hardware and software resources of a computer....
s, thus it can be viewed as a hosted virtual machine monitor. It also provides an accelerated mode for supporting a mixture of binary translation
(for kernel code) and native execution (for user code), in the same fashion as VMware WorkstationVMware Workstation

VMware Workstation is a virtual machine software suite for x86 and x86-64 computers from VMware, a division of EMC Corporati...
 and Microsoft Virtual PCMicrosoft Virtual PC

Virtual PC is a virtualization suite for Microsoft Windows operating systems, and an emulation suite for Apple Mac OS X....
. QEMU can also be used purely for CPU emulation for user level processes; in this mode of operation it is most similar to valgrindFacts About Valgrind

Valgrind is a free programming tool for memory debugging, memory leak detection, and profiling....
.

Licensing

QEMU was written by Fabrice BellardFabrice Bellard

Fabrice Bellard is a computer programmer who is best known as the founder of FFmpeg and project leader for QEMU....
 and is free softwareFree software

Free software, as defined by the Free Software Foundation, is software which can be used, copied, studied, modified and redi...
. Specifically, the QEMU virtual CPU core library is released under the GNU Lesser General Public LicenseGNU Lesser General Public License

The GNU Lesser General Public License is a free software license published by the Free Software Foundation....
 (GNU LGPL). Many hardware device emulation sources are released under the BSD license. When running on WindowsMicrosoft Windows

Microsoft Windows is a family of operating systems by Microsoft....
, it usually uses the proprietary FMODFMOD

FMOD is an audio library that makes it possible to play music files of diverse formats on many different platforms....
 library, which disqualifies it for a single, unified, Open SourceOpen source

Open source describes practices in production and development that promote access to the end product's sources....
 software license.

Details

QEMU has two operating modes:

User mode emulation
QEMU can launch LinuxLinux

Linux is a Unix-like computer operating system....
 or DarwinDarwin (operating system)

name = Darwin|logo =|developer = Apple Computer...
/Mac OS XMac OS X

Mac OS X is a line of proprietary, graphical operating systems developed, marketed, and sold by Apple Computer, the latest ...
 processes compiled for one CPU on another CPU. Target OS system calls are thunkThunk

The word thunk has two meanings in computer science:...
ed for endiannessEndianness

In computing, endianness generally refers to sequencing methods used in a one-dimensional system ....
 and 32/64 bit mismatches. WineWine (software)

name = Wine|logo = |caption =|developer =...
 windows API reimplementation and DOSEMUDOSEMU

DOSEMU, alternatively rendered dosemu, is a compatibility layer software package that enables MS-DOS software to run u...
 are the main targets for QEMU in user mode emulation. This mode also eases cross-compilation and cross-debugging.

Complete Computer System mode emulation
QEMU emulates a full computer system, including a processor and various peripheralFacts About Peripheral

A peripheral is a type of computer hardware that is added to a host computer in order to expand its abilities....
s. It can be used to provide virtual hosting of several virtual computers on a single computer. QEMU can boot many guest operating systemOperating system

An operating system is a software program that manages the hardware and software resources of a computer....
s, including LinuxLinux

Linux is a Unix-like computer operating system....
, Solaris, Microsoft WindowsMicrosoft Windows

Microsoft Windows is a family of operating systems by Microsoft....
, DOSDOS

DOS commonly refers to the family of closely related operating systems which dominated the IBM PC compatible market between ...
, and BSD ; it supports emulating several hardware platforms, including x86X86 architecture

x86 or 80x86 is the generic name of a microprocessor architecture first developed and manufactured by Intel....
, AMD64X86-64

x86-64 is a 64-bit microprocessor architecture and corresponding instruction set; it is a superset of the x86 architecture, ...
, AlphaDEC Alpha

he DEC Alpha, also known as the Alpha AXP, is a 64-bit RISC microprocessor originally developed and fabricated by Dig...
, MIPSMIPS architecture

MIPS, for Microprocessor without interlocked pipeline stages, is a RISC microprocessor architecture d...
, and SPARCSPARC

SPARC is a pure big-endian RISC microprocessor instruction set architecture originally designed in 1985 by Sun Microsystems...
.

Features

  • Supports emulating IA-32IA-32

    IA-32, sometimes generically called x86-32, is the instruction set architecture of Intel's most successful microprocessors....
     (x86) PCs, AMD64X86-64

    x86-64 is a 64-bit microprocessor architecture and corresponding instruction set; it is a superset of the x86 architecture, ...
     PCs, MIPSMIPS Technologies

    MIPS Technologies, formerly MIPS Computer Systems, is most widely known for developing the MIPS architecture and a ser...
     R4000, Sun's SPARCSPARC

    SPARC is a pure big-endian RISC microprocessor instruction set architecture originally designed in 1985 by Sun Microsystems...
     sun4m, Sun's SPARCSPARC

    SPARC is a pure big-endian RISC microprocessor instruction set architecture originally designed in 1985 by Sun Microsystems...
     sun4u, ARMARM architecture

    The ARM architecture is a 32-bit RISC processor architecture that is widely used in a number of embedded designs....
     development boards (Integrator/CP and Versatile/PB), SH4 SHIX board, PowerPCPowerPC

    PowerPC is a RISC microprocessor architecture created by the 1991 AppleIBMMotorola alliance, known as AIM....
    , and ETRAX CRISETRAX CRIS

    Axis ETRAX CRISA family of processors produced by Axis Communications....
     architectures.
  • Support for other architectures in both host and emulated systems (see homepage for complete list).
  • Increased speed—some applications can run in close to real time.
  • Implements Copy-On-Write disk image formats. You can declare a multi-gigabyte virtual drive, the disk image will only be as large as what is actually used.
  • Also implements overlay images. You can keep a snapshot of the guest system, and write changes to a separate image file. If the guest system breaks, it's simple to roll back to the snapshot.
  • Support for running Linux binaries for other architectures.
  • Can save and restore the state of the machine (programs running, etc.).
  • Virtual network card emulation.
  • SMP support.
  • Guest OS does not need to be modified/patched
  • Performance is improved when the KQEMU kernel module is used.
  • Command line tools allow a full control of QEMU without having to run X11.
  • Remote control of emulated machine via integrated VNC server
  • USB tablet support—this provides "grabless" mouse control. Activated with "-usb -usbdevice tablet".
  • QEMU does not need administrative rights to run.

TCG


TCG for Tiny Code Generator, aims to remove the shortcoming of relying on a particular version of GCCGNU Compiler Collection

The GNU Compiler Collection is a set of programming language compilers produced by the GNU Project....
 or any compiler, instead incorporating the compiler (code generator) into other tasks performed by QEMU in run-time. The whole translation task thus consists of two parts: blocks of target code (TBs) being rewritten in TCG ops - a kind of machine-independent intermediate notation, and subsequently this notation being compiled for the host's architecture by TCG. Optional optimisation passes are performed between them.

TCG requires that there be dedicated code written to support every architecture it is being run on. It also requires that the target instruction translation be rewritten to take advantage of TCG ops, instead of the previously used dyngen ops. Currently officially supported host architectures are x86X86 architecture

x86 or 80x86 is the generic name of a microprocessor architecture first developed and manufactured by Intel....
 and AMD64X86-64 Overview

x86-64 is a 64-bit microprocessor architecture and corresponding instruction set; it is a superset of the x86 architecture, ...
 only, however there exists in-development code for ARMARM architecture

The ARM architecture is a 32-bit RISC processor architecture that is widely used in a number of embedded designs....
, PowerPCPowerPC

PowerPC is a RISC microprocessor architecture created by the 1991 AppleIBMMotorola alliance, known as AIM....
, SPARCSPARC Overview

SPARC is a pure big-endian RISC microprocessor instruction set architecture originally designed in 1985 by Sun Microsystems...
, and HPPA. Targets that have been moved over to TCG include i386, AMD64, SPARC, CRISETRAX CRIS

Axis ETRAX CRISA family of processors produced by Axis Communications....
, MIPS and ARM. It is currently under development and is only available on qemu's SVN server.

Accelerator

Virtualization of machines or operating systems comes at a cost. That cost is speed of execution. One tried and true method to reduce the effect(cost) are software based drivers which perform specific functions that would otherwise be very costly to perform by the virtualization software. Two of those software programs, developed for QEMU, are KQEMU and QVM86.

KQEMU

Fabrice Bellard also wrote a Linux kernel moduleLoadable Kernel Module

Loadable Kernel Modules, or LKM, are object files that contain code to extend the running kernel, or so-called base ...
 (with preliminary ports to FreeBSDFreeBSD

colspan="2" | FreeBSD|-| colspan="2" style="text-align:center;" | br/>br />FreeBSD welcome screen...
 and MS Windows) named KQEMU or QEMU Accelerator, which notably speeds up x86 emulation on x86 platforms. This is accomplished by running user mode code directly on the host computer's CPU, and using processor and peripheral emulation only for kernel mode and real modeReal mode

Real mode is an operating mode of 80286 and later x86-compatible CPUs....
 code. KQEMU also supports a kernel emulation mode in which portions of kernel mode code run on the host's CPU.

Unlike KVMKernel-based Virtual Machine

name = Kernel-based Virtual Machine...
, KQEMU can execute code from many guest OSes even if the host CPU does not support hardware virtualization. KQEMU supports both x86 and x86_64 CPUs. As a future development for KQEMU there are plans to support the hardware(CPU) based virtualization extensions introduced by Intel VT and AMD-V families of processors.

Also of interest is that the QEMU Accelerator, KQEMU, was initially released free-of-charge but was licensed as a closed-source proprietary product. However, since version 1.3.0pre10, released on February 5, 2007, it has been available under the GNU General Public License(GPL).

QVM86

QVM86 was a Linux kernel moduleLoadable Kernel Module

Loadable Kernel Modules, or LKM, are object files that contain code to extend the running kernel, or so-called base ...
 to provide x86 virtualizationX86 virtualization

x86 virtualization is the method by which the x86 processor architecture is virtualized....
 capabilities for the QEMU emulatorEmulator

A software emulator allows computer programs to run on a platform other than the one for which they were originally written...
. Virtualization allowed "emulated" code to be run natively on the host CPU, using the CPU protection mechanisms to intercept and emulate privileged events. It was licensed under GNU GPLv2GNU General Public License

The GNU General Public License is a widely used free software license, originally written by Richard Stallman for the GNU p...
 license. It was developed as a drop-in replacement for the then closed-source KQEMU, which has since been made available under the GPL. The developer of QVM86 ceased development on January 21 2007 as they decided that the project had been rendered obsolete by the release of VirtualBoxVirtualBox

name = Sun xVM VirtualBox...
.

Integration in other virtualization solutions


VirtualBox

In January 2007, VirtualBox was released. It uses some of QEMU's virtual hardware devices and has a built-in dynamic recompilerDynamic recompilation

In computer science, dynamic recompilation is a feature of some emulators and virtual machines, where the system may recompi...
 that is based on QEMU. As with KQEMU, it runs nearly all guest code natively on the host via the VMM (Virtual Machine Manager), and uses the recompiler only for special situations as a fallback mechanism (this holds true for guest code that executes in real modeReal mode

Real mode is an operating mode of 80286 and later x86-compatible CPUs....
 and some other rare scenarios at runtime). In addition, VirtualBox goes through a lot of code analysis and patching via a built-in disassembler to reduce usage of the recompiler to a minimum. VirtualBox is open-source software under the GPL, except for a number of enterprise features, and standard user features like USB.

As of the 1.5.6 release( updated 2008-02-19 ) VirtualBox still has no support for SMP in a Guest OS. It has been confirmed by one of the developers of VirtualBox that SMP is stated to be added in a future release, but a fixed date for it can't be given.

Xen-HVM

The Xen virtual machine monitor can run in HVM (hardware virtual machine) mode, using Intel's VT-x or AMD's AMD-V hardware virtualization extensions. This means that instead of paravirtualized devices, a real set of virtual hardware is exposed to the domU to use real device drivers to talk to.

QEMU includes several components: CPU emulators, emulated devices, generic devices, machine descriptions, user interface, and a debugger. The emulated devices and generic devices in QEMU make up its device models for I/O virtualization .

Xen-HVM has device emulation based on the QEMU project to provide I/O virtualization to the VMs. Hardware is emulated via a patched QEMU "device manager" (qemu-dm) daemon running as a backend in dom0. This means that the vitualized machines see as hardware: a PIIX3 IDE (with some rudimentary PIIX4 capabilities), Cirrus Logic or vanilla VGA emulated video, RTL8139 or NE2000 network emulation, PAE, and somewhat limited ACPI and APIC support and no SCSI emulation.

Kernel-based Virtual Machine (KVM)

KVM is a linux kernel virtualization infrastructure. By itself, it does not perform any emulation. Instead, a user-space program uses the /dev/kvm interface to set up the guest VM's address space, feed it simulated I/O and map its video display back onto the host's and currently, the only such program that does this is a modified version of QEMU .

Darwine

Darwine was originally intended to support compiling of Win32 source into Mach-O/PowerPC binaries for Macintosh computers. The project shifted objectives combining Wine's program loader with QEMU in user mode emulation, to allow running of Win32 binaries on Mac OS X for PowerPC.

Win4Lin Pro Desktop

In early 2005, Win4Lin introduced Win4Lin Pro Desktop, based on a 'tuned' version of QEMU and KQEMU and it hosts NT-versions of Windows. In June 2006, Win4Lin released Win4Lin Virtual Desktop Server based on the same code base. Win4Lin Virtual Desktop Server serves Microsoft Windows sessions to thin clients from a Linux server.

In September 2006, Win4Lin announced a change of the company name to Virtual Bridges with the release of Win4BSD Pro Desktop, a port of the product to FreeBSD and PC-BSD. Solaris support followed in May 2007 with the release of Win4Solaris Pro Desktop and Win4Solaris Virtual Desktop Server.

Shortcomings


  • Incomplete support for Microsoft WindowsMicrosoft Windows

    Microsoft Windows is a family of operating systems by Microsoft....
     and other host operating systems; this has improved with recent versions
  • Incomplete support for less frequently-used architectures
  • No special device driverDevice driver

    A device driver, or a software driver is a specific type of computer software, typically developed to allow interactio...
    s (graphics, sound, IO) for guests are available, thus quite large overhead for multimedia applications. For example, a Cirrus LogicCirrus Logic

    Cirrus Logic is a fabless semiconductor supplier specializing in analog, mixed-signal, and DSP chips....
     graphics chip and various popular sound cards are emulated, but they do not provide hardware-accelerated performance on the host system. Also, it supports only SDLSimple DirectMedia Layer

    Simple DirectMedia Layer is a cross-platform multimedia library written in C that creates an abstraction over various platf...
     or CocoaCocoa (API)

    Cocoa is Apple Computer's native object-oriented application programming environment for the Mac OS X operating system....
     video output libraries although a patch for GGI support exists
  • Doesn't compile with modern versions of GCCGNU Compiler Collection

    The GNU Compiler Collection is a set of programming language compilers produced by the GNU Project....
     (no support for versions 4.x). This will be fixed with the TCG.

Qemu-Launcher

Qemu Launcher is a Gtk+GTK+

The GIMP Toolkitabbreviated, and almost exclusively known, as GTK+is one of the two most popular widget toolkits for t...
 front-end for QEMU, written by Erik Meitner and Linas ˇvirblis. Qemu Launcher provides a graphical front-end to many QEMU computer emulator options. It has the capability to create, save, and run multiple virtual machine configurations, and to create and convert disk images. Qemu Launcher also supports launching virtual machines from the command line.

Qemulator

Qemulator is a graphical manager for QEMU under Linux, written by Rainer Haage. Qemulator consists of two components: a management surface to create and set up virtual machines, and a control-panel to manage the on demand functions for a running machine such as mounting and unmounting of filesystems, attaching USB devices, and starting, stopping, pausing or resettting a running system. The control panel also is able to take screenshotScreenshot Overview

A screenshot, screen dump, or screen capture or screenie is an...
s and to record audio from the current virtual machineVirtual machine

In computer science, a virtual machine is software that creates a virtualized environment between the computer platform so t...
. The command used to start QEMU can be copied to the clipboard for use elsewhere, including starting QEMU without using the launcher.

See also


  • qcowQcow

    "qcow" is a type of disk image that can be used with the QEMU emulator, the other types being vvfat, vpc, bochs, .dmg, cloop...
  • Comparison of virtual machinesComparison of virtual machines

    The table below compares basic information about virtual machine packages, including: creator, guest systems supported, license, e...
  • FreeOsZooFreeOsZoo

    The FreeOsZoo project has been created by Renzo Davoli, professor at University of Bologna, and is currently maintained by S...
  • OpenBIOSOpenBIOS Summary

    OpenBIOS is a free software, portable Open Firmware implementation which is licensed under the terms of the GNU General Publ...
  • Q (emulator)Q (emulator)

    Q is free emulator software that runs on Mac OS X....


External links


  • an IBM developerWorks article by M. Tim Jones