When kvm encounters a trapping instruction, it will vmexits the guest and vmenters the host. the host then emulates the instruction on the vm guest register-saving area. I have a few questions regarding this.
1. There is an emulation context struct x86_emulate_ctxt { struct x86_emulate_ops *ops; /* Register state before/after emulation. */ struct kvm_vcpu *vcpu; ... /* decode cache */ struct decode_cache decode; }; What is the decode_cache here and where does it get filled out ? 2. When the host is emulating instructions for the guest, it may need to access the guest memory, I guess there are really 2 questions here. 1. is the guest memory physically contiguous ? 2. how does the host access the guest memory ? there must be some functions or macros ? Thanks Xin