VirtualBox

Changes between Version 5 and Version 6 of VirtualBox architecture


Ignore:
Timestamp:
Nov 16, 2006 4:55:29 PM (17 years ago)
Author:
jose
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • VirtualBox architecture

    v5 v6  
    4343When a VM is running, from your processor's point of view, your computer can be in one of several states:
    4444
    45  1. It can be '''executing host ring-3 code''' (e.g. from other host processes), or '''host ring-0 code,''' just as it would be if !VirtualBox wasn't running.
    46  2. It can be '''emulating guest code'''. Basically, !VirtualBox tries to run as much guest code natively as possible and emulates guest code when it is lost about why guest code is not working. Typically, the emulator steps in as a fallback when
    47     * guest code disables interrupts and !VirtualBox cannot determine when they will be switched back on;
     45 1. Your CPU can be '''executing host ring-3 code''' (e.g. from other host processes), or '''host ring-0 code,''' just as it would be if !VirtualBox wasn't running.
     46 2. Your CPU  can be '''emulating guest code.''' Basically, !VirtualBox tries to run as much guest code natively as possible. But can (slowly) emulate guest code as a fallback when it is lost about why guest code is not working, or when the performance penalty of emulation is not too high. Our emulator (in `src/emulator/`) is based on [http://fabrice.bellard.free.fr/qemu/ QEMU] and typically steps in when
     47    * guest code disables interrupts and !VirtualBox cannot figure out when they will be switched back on (in these situations, !VirtualBox actually analyzes the guest code using its own disassembler in  `src/VBox/Disassembler/`);
    4848    * for execution of certain single instructions; this typically happens when a nasty guest instruction such as `LIDT` has caused a trap and needs to be emulated;
    4949    * for any real-mode code (e.g. BIOS code, a DOS guest, or any operating system startup).
    50  3. It can be '''running guest ring-3 code natively.''' In !VirtualBox, this is called "raw ring 3". This is, of course, the most efficient way to run the guest, and hopefully we don't leave this mode too often. The more we do, the slower the VM is compared to a native OS, because all context switches are very expensive.
    51  4. It can be '''running guest ring-0 code natively.''' Here is where things get hairy: The guest only ''thinks'' it's running ring-0 code, but !VirtualBox has patched the guest OS to instead enter ring 1 (which is normally unused with x86 operating systems).
     50 3. Your CPU can be '''running guest ring-3 code natively.''' In !VirtualBox, this is called "raw ring 3". This is, of course, the most efficient way to run the guest, and hopefully we don't leave this mode too often. The more we do, the slower the VM is compared to a native OS, because all context switches are very expensive.
     51 4. Your CPU can be '''running guest ring-0 code natively.''' Here is where things get hairy: The guest only ''thinks'' it's running ring-0 code, but !VirtualBox has patched the guest OS to instead enter ring 1 (which is normally unused with x86 operating systems).
    5252
    5353Also, in the !VirtualBox source code, you will find lots of references to "host context" or "guest context". Essentially, these mean:

© 2023 Oracle
ContactPrivacy policyTerms of Use