I am new to virtualization and trying to understand basic idea behind the instuction set emulation.
I am following the e500 core instruction set emulation .
http://www.linux-kvm.org/page/E500_virtual_CPU_specification
This particular "kvmppc_core_emulate_mtspr()" in kernel code is emulating the mtspr instruction of powerpc core.
Would want to know what exactly we are doing inside this function to emulate mtspr and why only two instructions(mtspr and mfspr) are emulated as per e500_emulate.c
Hardware-assisted virtualization is the art of executing as many of the instructions of the target program directly, without emulation. A processor that supports hardware-assisted virtualization is designed so that only a few privileged instructions cannot be executed directly. Since the processor is executing the target code directly, when one of these instructions appears, it has to have a mechanism to transfer control back to the hypervisor, which may want to emulate in software the effects the privileged instruction is supposed to have, so as to make it look to the target program that it is being executed directly. This is how running an unmodified OS that was not designed for this inside an hypervisor can be achieved.
Only two instructions are emulated because only these two need to be. The others are executed directly and at full speed by the processor, without emulation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With