[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [HVM] Save/restore: explicitly name MSRs in save format
# HG changeset patch # User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx> # Date 1171629270 0 # Node ID d5076a33cbb199e90f823219d7fcfca25341b285 # Parent eecd0361df4a750d313282e4506a06bd97cf8564 [HVM] Save/restore: explicitly name MSRs in save format Signed off by: Mats Petersson (Mats.Petersson@xxxxxxx) --- xen/arch/x86/hvm/svm/svm.c | 32 +++++++++++++------------------- xen/arch/x86/hvm/vmx/vmx.c | 18 +++++++++++------- xen/include/public/hvm/save.h | 11 ++++++++--- 3 files changed, 32 insertions(+), 29 deletions(-) diff -r eecd0361df4a -r d5076a33cbb1 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Fri Feb 16 12:13:33 2007 +0000 +++ b/xen/arch/x86/hvm/svm/svm.c Fri Feb 16 12:34:30 2007 +0000 @@ -362,7 +362,7 @@ static inline void __restore_debug_regis } -int svm_vmcs_save(struct vcpu *v, struct hvm_hw_cpu *c) +int svm_vmcb_save(struct vcpu *v, struct hvm_hw_cpu *c) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; @@ -571,17 +571,14 @@ void svm_save_cpu_state(struct vcpu *v, { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; - data->shadow_gs = vmcb->kerngsbase; - /* MSR_LSTAR, MSR_STAR, MSR_CSTAR, MSR_SYSCALL_MASK, MSR_EFER */ - data->msr_items[0] = vmcb->lstar; - data->msr_items[1] = vmcb->star; - data->msr_items[2] = vmcb->cstar; - data->msr_items[3] = vmcb->sfmask; - data->msr_items[4] = vmcb->efer; + data->shadow_gs = vmcb->kerngsbase; + data->msr_lstar = vmcb->lstar; + data->msr_star = vmcb->star; + data->msr_cstar = vmcb->cstar; + data->msr_syscall_mask = vmcb->sfmask; + data->msr_efer = vmcb->efer; data->tsc = hvm_get_guest_time(v); - - // dump_msr_state(guest_state); } @@ -590,22 +587,19 @@ void svm_load_cpu_state(struct vcpu *v, struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; vmcb->kerngsbase = data->shadow_gs; - /* MSR_LSTAR, MSR_STAR, MSR_CSTAR, MSR_SYSCALL_MASK, MSR_EFER */ - vmcb->lstar = data->msr_items[0]; - vmcb->star = data->msr_items[1]; - vmcb->cstar = data->msr_items[2]; - vmcb->sfmask = data->msr_items[3]; - vmcb->efer = data->msr_items[4]; + vmcb->lstar = data->msr_lstar; + vmcb->star = data->msr_star; + vmcb->cstar = data->msr_cstar; + vmcb->sfmask = data->msr_syscall_mask; + vmcb->efer = data->msr_efer; hvm_set_guest_time(v, data->tsc); - - // dump_msr_state(guest_state); } void svm_save_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt) { svm_save_cpu_state(v, ctxt); - svm_vmcs_save(v, ctxt); + svm_vmcb_save(v, ctxt); } int svm_load_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt) diff -r eecd0361df4a -r d5076a33cbb1 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Fri Feb 16 12:13:33 2007 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Fri Feb 16 12:34:30 2007 +0000 @@ -583,15 +583,17 @@ void vmx_save_cpu_state(struct vcpu *v, { struct vmx_msr_state *guest_state = &v->arch.hvm_vmx.msr_state; unsigned long guest_flags = guest_state->flags; - int i = 0; data->shadow_gs = guest_state->shadow_gs; /* save msrs */ data->flags = guest_flags; - for (i = 0; i < VMX_MSR_COUNT; i++) - data->msr_items[i] = guest_state->msrs[i]; - + data->msr_lstar = guest_state->msrs[VMX_INDEX_MSR_LSTAR]; + data->msr_star = guest_state->msrs[VMX_INDEX_MSR_STAR]; + data->msr_cstar = guest_state->msrs[VMX_INDEX_MSR_CSTAR]; + data->msr_syscall_mask = guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK]; + data->msr_efer = guest_state->msrs[VMX_INDEX_MSR_EFER]; + data->tsc = hvm_get_guest_time(v); dump_msr_state(guest_state); @@ -599,13 +601,15 @@ void vmx_save_cpu_state(struct vcpu *v, void vmx_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data) { - int i = 0; struct vmx_msr_state *guest_state = &v->arch.hvm_vmx.msr_state; /* restore msrs */ guest_state->flags = data->flags; - for (i = 0; i < VMX_MSR_COUNT; i++) - guest_state->msrs[i] = data->msr_items[i]; + guest_state->msrs[VMX_INDEX_MSR_LSTAR] = data->msr_lstar; + guest_state->msrs[VMX_INDEX_MSR_STAR] = data->msr_star; + guest_state->msrs[VMX_INDEX_MSR_CSTAR] = data->msr_cstar; + guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK] = data->msr_syscall_mask; + guest_state->msrs[VMX_INDEX_MSR_EFER] = data->msr_efer; guest_state->shadow_gs = data->shadow_gs; diff -r eecd0361df4a -r d5076a33cbb1 xen/include/public/hvm/save.h --- a/xen/include/public/hvm/save.h Fri Feb 16 12:13:33 2007 +0000 +++ b/xen/include/public/hvm/save.h Fri Feb 16 12:34:30 2007 +0000 @@ -140,10 +140,16 @@ struct hvm_hw_cpu { uint64_t sysenter_esp; uint64_t sysenter_eip; - /* MSRs */ + /* msr for em64t */ uint64_t shadow_gs; uint64_t flags; - uint64_t msr_items[6]; + + /* msr content saved/restored. */ + uint64_t msr_lstar; + uint64_t msr_star; + uint64_t msr_cstar; + uint64_t msr_syscall_mask; + uint64_t msr_efer; /* guest's idea of what rdtsc() would return */ uint64_t tsc; @@ -311,7 +317,6 @@ struct hvm_hw_pci_link { DECLARE_HVM_SAVE_TYPE(PCI_LINK, 9, struct hvm_hw_pci_link); - /* * PIT */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |