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/`); |
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). |