how is machine-virtualization achieved without hardware support

1.2k views Asked by At

this is with reference to machine virtualization. I am going through virtualization and got to know that With hardware assisted virtualization technique, privileged instructions are identified by trap-fault method and replaced with equivalent user-level instructions on the fly. but how is/was virtualization achieved in absence of hardware support? prior to Intel VTi or AMD-V, how was privileged instrutions trapped on the fly by software itself? everywhere the :"binary translation" term is used which is fine as far as replacing the privileged instruction with user instructions is concerned but how the privileged instructions ran by guest os is identified by virtualization tool(hypervisor/vmm)


edit: some people are thinking that this question does not show research effort and are down-voting. These are some of the papers that I went through

overview : https://www.vmware.com/pdf/virtualization.pdf

intel doc: https://software.intel.com/sites/default/files/m/d/4/1/d/8/An_Introduction_to_Virtualization.pdf

Intorduction: http://www.kernelthread.com/publications/virtualization/

x86 virtualization http://en.wikipedia.org/wiki/X86_virtualization

comparison of hw sf virtualization: http://www.vmware.com/pdf/asplos235_adams.pdf

nuts and bolts: http://www.anandtech.com/show/2480

paravirtualization: http://en.wikipedia.org/wiki/Paravirtualization

if anyone has any paper/source which can answer the question asked above and I might have missed kindly respond.

2

There are 2 answers

6
Craig S. Anderson On

In the absence of hardware support, paravirtualization can be used. Guest operating systems are modified so that instead of accessing certain hardware resources directly, calls are made to virtual machine manager (VMM) or hypervisor.

For example, a guest operating system on x86 cannot be allowed to disable interrupts on the actual CPU. Instead, the guest OS makes a call to the VMM to simulate disabling interrupts.

Another alternative is native virtualization. In native virtualization, the instructions of the guest OS and its processes are emulated. The emulation layer allows privileged instructions like cli to be handled by the virtualization software. Thus native virtualization requires neither hardware support nor modifying the guest OS.

0
missimer On

If you do not have hardware virtualization and you do not want to consider paravirtualization the other option is binary translation. The problem with x86 (I'm assuming were are talking about x86) is that there are certain sensative instructions that are not privileged (See Popek and Goldberg virtualization requirements). By privileged in this sense I mean that it will cause a trap from user to kernel mode. Since these instructions are found in the guest kernel (which runs with userspace privileges as guest) but do not cause an exit they can be a problem. For example, popf behaves differently depending on whether it is invoked in user or kernel (Intel reference manual volume 2, see section on popf). Therefore when the guest executes popf we want the VM to exit but it won't. In binary translation we basically scan the kernel binary and replace all machine code that corresponds to sensitive unprivileged instructions with machine code that will perform the correct emulation or more likely cause a VM exit so the hypervisor can intervene. A little bit of this can be found in this VMware document. Most of the other documents I can find that explain binary translation in any depth are behind paywalls.