What is meant by trap-and-emulate virtualization?
Asked Answered
S

3

22

I read the term trap-and-emulate virtualization in some articles on how to set up a virtual pc. Can anyone please tell me what this term means?

I understood that it definitely is some method for creating a virtual pc. But how is it done?

Spherics answered 4/12, 2013 at 23:16 Comment(1)
This is what I remember: an OS can be run in a virtual machine (for a variety of reasons), thus becoming a non-privileged program (so it can't run in kernel mode, with all the privileged instructions and registers available). Trap-and-emulate is a technique used by the virtual machine to emulate privileged instructions and registers and pretend to the OS that it's still in kernel mode.Esemplastic
R
35

An operation system is designed to have full control of the system. But when an OS is running as a virtual machine in a hypervisor, some of its instructions may conflict with the host operation system. So what does the hypervisor do? It emulates the effect of that specific instruction or action without carrying it out. In this way, the host OS is not effected by the guest's actions. This is called trap and emulate.

Retroact answered 8/7, 2014 at 7:7 Comment(0)
W
7

Attempting a privileged instruction when in user mode causes an error to occur thus leading to trap state.

And after this the VMM (Virtual Machine Manager) gets control and analyzed the error , executes the operation as attempted by the guest and then return the control back to guest in user mode.

Note : Kernel mode privileged command runs slower due to trap and emulate

Wellstacked answered 19/11, 2019 at 5:21 Comment(0)
F
1

There are two types of operations performed by OS/Application running on Virtual Machine Manager (or Hypervisor):

  1. Non-privileged - Hypervisor directly allows OS/App to perform these operations.
  2. Privileged - Hypervisor uses the Trap-and-Emulate method to determine whether the operation is legal or illegal. It creates a trap for privileged operation first. Then, if the operation is illegal, the hypervisor terminates the operation, and if it is a legal operation, it emulates the behavior guest OS/App expects from the hardware.
Fearless answered 23/12, 2021 at 7:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.