提交 f5b42c33 编写于 作者: A Avi Kivity

KVM: Fix guest sysenter on vmx

The vmx code currently treats the guest's sysenter support msrs as 32-bit
values, which breaks 32-bit compat mode userspace on 64-bit guests.  Fix by
using the native word width of the machine.
Signed-off-by: NAvi Kivity <avi@qumranet.com>
上级 ca45aaae
...@@ -371,10 +371,10 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) ...@@ -371,10 +371,10 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
data = vmcs_read32(GUEST_SYSENTER_CS); data = vmcs_read32(GUEST_SYSENTER_CS);
break; break;
case MSR_IA32_SYSENTER_EIP: case MSR_IA32_SYSENTER_EIP:
data = vmcs_read32(GUEST_SYSENTER_EIP); data = vmcs_readl(GUEST_SYSENTER_EIP);
break; break;
case MSR_IA32_SYSENTER_ESP: case MSR_IA32_SYSENTER_ESP:
data = vmcs_read32(GUEST_SYSENTER_ESP); data = vmcs_readl(GUEST_SYSENTER_ESP);
break; break;
default: default:
msr = find_msr_entry(vcpu, msr_index); msr = find_msr_entry(vcpu, msr_index);
...@@ -412,10 +412,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) ...@@ -412,10 +412,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
vmcs_write32(GUEST_SYSENTER_CS, data); vmcs_write32(GUEST_SYSENTER_CS, data);
break; break;
case MSR_IA32_SYSENTER_EIP: case MSR_IA32_SYSENTER_EIP:
vmcs_write32(GUEST_SYSENTER_EIP, data); vmcs_writel(GUEST_SYSENTER_EIP, data);
break; break;
case MSR_IA32_SYSENTER_ESP: case MSR_IA32_SYSENTER_ESP:
vmcs_write32(GUEST_SYSENTER_ESP, data); vmcs_writel(GUEST_SYSENTER_ESP, data);
break; break;
case MSR_IA32_TIME_STAMP_COUNTER: case MSR_IA32_TIME_STAMP_COUNTER:
guest_write_tsc(data); guest_write_tsc(data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册