tldr
qemu is an emulator. The qemu process owns the huge state machine which simulates a PC. Neither OS nor CPU running qemu is aware of the guest VM. All cpu instruction varies at side effects while driving the state machine in qemu.
The privileged instructions have no privilege in the view of qemu. Most importantly, qemu provides lots of hardware simulators like e1000, i440fx.
Qemu requires no host cpu feature.
kvm is an accelerator of qemu. Kvm utilizes vm extension of cpu to execute plain non-privileged instructions and take over the control from guest privileged instructions (cpu virtualization), as long as VMCS is populated and control registers are set correctly by host OS. The guest os image can be byte to byte equivalent to the host os image but the cpu executions are different since the flags in physical cpu registers are set to "guest mode" while executing cpu instructions in the guest OS.
rr is a delicate debugger in the view of the target process or binary. Another view is a "malicious" OS that disguises the target process the required syscall is executed but returning a recorded value. rr doesn't live in the kernel for now, so rr requires the co-op of the target process not intentionally revert the benevolent temporary changes to the target process. Similar to Qemu, rr also needs to understand the side effect of each cpu instruction to record the side effect for future replay, even though the instruction is not considered as "privileged". An example is a wall clock read instruction. rr need to intercept the instruction and return the recorded value to the target process.
No comments:
Post a Comment