All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] use explicit 64bit storage for sysenter values
@ 2009-05-28  9:56 Andre Przywara
  2009-05-28  9:56 ` [PATCH 2/2] add sysenter/syscall emulation for 32bit compat mode Andre Przywara
  2009-05-31  8:53 ` [PATCH 1/2] use explicit 64bit storage for sysenter values Avi Kivity
  0 siblings, 2 replies; 6+ messages in thread
From: Andre Przywara @ 2009-05-28  9:56 UTC (permalink / raw)
  To: avi; +Cc: kvm, Andre Przywara, Christoph Egger

Since AMD does not support sysenter in 64bit mode, the VMCB fields storing
the MSRs are truncated to 32bit upon VMRUN/#VMEXIT. So store the values
in a separate 64bit storage to avoid truncation.

Signed-off-by: Christoph Egger <christoph.egger@amd.com>
---
 arch/x86/kvm/kvm_svm.h |    4 ++++
 arch/x86/kvm/svm.c     |   12 ++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/kvm_svm.h b/arch/x86/kvm/kvm_svm.h
index ed66e4c..4129dc1 100644
--- a/arch/x86/kvm/kvm_svm.h
+++ b/arch/x86/kvm/kvm_svm.h
@@ -27,6 +27,10 @@ struct vcpu_svm {
 	unsigned long vmcb_pa;
 	struct svm_cpu_data *svm_data;
 	uint64_t asid_generation;
+	uint64_t sysenter_cs;
+	uint64_t sysenter_esp;
+	uint64_t sysenter_eip;
+	struct kvm_segment user_cs; /* used in sysenter/sysexit emulation */
 
 	u64 next_rip;
 
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index dd667dd..f0f2885 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1978,13 +1978,13 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
 		break;
 #endif
 	case MSR_IA32_SYSENTER_CS:
-		*data = svm->vmcb->save.sysenter_cs;
+		*data = svm->sysenter_cs;
 		break;
 	case MSR_IA32_SYSENTER_EIP:
-		*data = svm->vmcb->save.sysenter_eip;
+		*data = svm->sysenter_eip;
 		break;
 	case MSR_IA32_SYSENTER_ESP:
-		*data = svm->vmcb->save.sysenter_esp;
+		*data = svm->sysenter_esp;
 		break;
 	/* Nobody will change the following 5 values in the VMCB so
 	   we can safely return them on rdmsr. They will always be 0
@@ -2068,13 +2068,13 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
 		break;
 #endif
 	case MSR_IA32_SYSENTER_CS:
-		svm->vmcb->save.sysenter_cs = data;
+		svm->sysenter_cs = data;
 		break;
 	case MSR_IA32_SYSENTER_EIP:
-		svm->vmcb->save.sysenter_eip = data;
+		svm->sysenter_eip = data;
 		break;
 	case MSR_IA32_SYSENTER_ESP:
-		svm->vmcb->save.sysenter_esp = data;
+		svm->sysenter_esp = data;
 		break;
 	case MSR_IA32_DEBUGCTLMSR:
 		if (!svm_has(SVM_FEATURE_LBRV)) {
-- 
1.6.1.3



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-07  7:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28  9:56 [PATCH 1/2] use explicit 64bit storage for sysenter values Andre Przywara
2009-05-28  9:56 ` [PATCH 2/2] add sysenter/syscall emulation for 32bit compat mode Andre Przywara
2009-05-31  8:59   ` Avi Kivity
2009-06-05 12:23     ` Andre Przywara
2009-06-07  7:09       ` Avi Kivity
2009-05-31  8:53 ` [PATCH 1/2] use explicit 64bit storage for sysenter values Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.