On 23/10/15 18:16, Mike wrote:
Hello,

I'm doing some reviewing of XEN source code.  Does x86_emulate() (from x86_emulate.c) execute on every guest, or is this whenever a machine doesn't have hardware assisted virtualization?

By default, guests do not have instructions emulated.  They run on the real hardware.

There are situations which occur, (as a side effect of virtualisation), when it traps into Xen.  e.g. updating pagetables while shadow paging is in use, a write hitting an MMIO page emulated by Qemu, etc.

In such circumstances, the instruction which faulted must be emulated so Xen can work out what the guest did, and apply the appropriate action.  e.g. update the pagetable as requested or forward an io request to qemu.

Especially for the SIMD instructions, x86_emulate() is not capable of providing a software alternative to an instruction not supported by the hardware.

~Andrew