On 10/15/2009 11:41 PM, oritw@xxxxxxxxxx wrote:
From: Orit Wasserman<oritw@xxxxxxxxxx> --- arch/x86/kvm/vmx.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 65 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 71bd91a..411cbdb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -61,15 +61,26 @@ module_param_named(unrestricted_guest, static int __read_mostly emulate_invalid_guest_state = 0; module_param(emulate_invalid_guest_state, bool, S_IRUGO); -struct vmcs { - u32 revision_id; - u32 abort; - char data[0]; +struct __attribute__ ((__packed__)) level_state { + /* Has the level1 guest done vmclear? */ + bool vmclear; };
Why __packed__?
struct nested_vmx { /* Has the level1 guest done vmxon? */ bool vmxon; + + /* + * Level 2 state : includes vmcs,registers and + * a copy of vmcs12 for vmread/vmwrite + */ + struct level_state *l2_state; +}; + +struct vmcs { + u32 revision_id; + u32 abort; + char data[0]; };
Why move struct vmcs around?
+ static int handle_vmoff(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); @@ -3310,6 +3368,8 @@ static int handle_vmon(struct kvm_vcpu *vcpu) vmx->nested.vmxon = 1; + create_l2_state(vcpu); +
Need to check return code. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html