Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between trap and emulate and binary translation?

I understand what trap and emulate is, however I'm struggling to understand what binary translation is and how it differs from trap and emulate. I'm very new to this topic and am trying to understand this introduction from a paper from 2006:

"Until recently, the x86 architecture has not permitted classical trap-and-emulate virtualization. Virtual Machine Monitors for x86, such as VMware ® Workstation and Virtual PC, have instead used binary translation of the guest kernel code. However, both Intel and AMD have now introduced architectural extensions to support classical virtualization."

I also don't understand what "classical virtualization" is in the context trap and emulate vs binary translation. Any help understanding these terms would be appreciated.

like image 345
PCR Avatar asked Apr 02 '17 01:04

PCR


People also ask

What is trap and emulation?

Trap and emulate is a technique that takes the basic of the emulation but improves performance by using interpretation selectively. In this method also, both the user applications and guest operating system of virtual machines run in the user mode and the hypervisor runs in the privileged mode.

How does trap and emulate work in virtual machines?

When a trap is set, performing a specific action that would normally be allowed causes an exception to a higher Exception level. A hypervisor can use these traps to emulate operations within a VM. For example, executing a Wait For Interrupt (WFI) instruction usually puts the CPU into a low power state.

What do you understand by binary translation?

In computing, binary translation is a form of binary recompilation where sequences of instructions are translated from a source instruction set to the target instruction set.

What is binary translation in virtualization?

Binary translation is a software virtualization and includes the use of an interpreter. It translates binary code to another binary, but excluding nontrapping instructions.


Video Answer


1 Answers

I think this link will help you. I have tried to summarized it, for more information refer the link.

Whenever the guest operating system tries to perform one of these privileged operations, the processor will "trap" the instruction and hand over control to the host operating system or hypervisor, so that it can do the required operation and then return control back to the guest. But most real-world instruction sets, including x86, were not designed with virtualization in mind. As a result, there are privileged instructions that do not have any corresponding trap facility.

Binary translation addresses this problem directly. Instead of depending on the processor itself to detect the privileged instructions it uses virtualization software that inspects the instruction stream in software and whenever the virtualization software detects a problem instruction, it rewrites it on-the-fly,typically replacing it with a kind of manual trap, that will hand over control to the hypervisor at the appropriate moment. Hope this helps you.

like image 198
Anagh Hegde Avatar answered Oct 15 '22 05:10

Anagh Hegde