diff options
author | He, Qing <qing.he@intel.com> | 2007-09-12 02:18:28 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:28 -0400 |
commit | bfdaab090386e7dda8c442721eeb91179258dad4 (patch) | |
tree | 35c7a10421a67316c0aa87f70b11db829137e4b9 /drivers/kvm/vmx.c | |
parent | 04d2cc7780d48a212843e38d46402d97fa1f4774 (diff) |
KVM: VMX: Fix exit qualification width on i386
According to Intel Software Developer's Manual, Vol. 3B, Appendix H.4.2,
exit qualification should be of natural width. However, current code
uses u64 as the data type for this register, which occasionally
introduces invalid value to VMExit handling logics. This patch fixes
this bug.
I have tested Windows and Linux guest on i386 host, and they can boot
successfully with this patch.
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index fa4277d520ca..c44c9ac79ca5 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -1840,12 +1840,12 @@ static int handle_triple_fault(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1840 | 1840 | ||
1841 | static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1841 | static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1842 | { | 1842 | { |
1843 | u64 exit_qualification; | 1843 | unsigned long exit_qualification; |
1844 | int size, down, in, string, rep; | 1844 | int size, down, in, string, rep; |
1845 | unsigned port; | 1845 | unsigned port; |
1846 | 1846 | ||
1847 | ++vcpu->stat.io_exits; | 1847 | ++vcpu->stat.io_exits; |
1848 | exit_qualification = vmcs_read64(EXIT_QUALIFICATION); | 1848 | exit_qualification = vmcs_readl(EXIT_QUALIFICATION); |
1849 | string = (exit_qualification & 16) != 0; | 1849 | string = (exit_qualification & 16) != 0; |
1850 | 1850 | ||
1851 | if (string) { | 1851 | if (string) { |
@@ -1877,11 +1877,11 @@ vmx_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall) | |||
1877 | 1877 | ||
1878 | static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1878 | static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1879 | { | 1879 | { |
1880 | u64 exit_qualification; | 1880 | unsigned long exit_qualification; |
1881 | int cr; | 1881 | int cr; |
1882 | int reg; | 1882 | int reg; |
1883 | 1883 | ||
1884 | exit_qualification = vmcs_read64(EXIT_QUALIFICATION); | 1884 | exit_qualification = vmcs_readl(EXIT_QUALIFICATION); |
1885 | cr = exit_qualification & 15; | 1885 | cr = exit_qualification & 15; |
1886 | reg = (exit_qualification >> 8) & 15; | 1886 | reg = (exit_qualification >> 8) & 15; |
1887 | switch ((exit_qualification >> 4) & 3) { | 1887 | switch ((exit_qualification >> 4) & 3) { |
@@ -1950,7 +1950,7 @@ static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1950 | 1950 | ||
1951 | static int handle_dr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1951 | static int handle_dr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1952 | { | 1952 | { |
1953 | u64 exit_qualification; | 1953 | unsigned long exit_qualification; |
1954 | unsigned long val; | 1954 | unsigned long val; |
1955 | int dr, reg; | 1955 | int dr, reg; |
1956 | 1956 | ||
@@ -1958,7 +1958,7 @@ static int handle_dr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1958 | * FIXME: this code assumes the host is debugging the guest. | 1958 | * FIXME: this code assumes the host is debugging the guest. |
1959 | * need to deal with guest debugging itself too. | 1959 | * need to deal with guest debugging itself too. |
1960 | */ | 1960 | */ |
1961 | exit_qualification = vmcs_read64(EXIT_QUALIFICATION); | 1961 | exit_qualification = vmcs_readl(EXIT_QUALIFICATION); |
1962 | dr = exit_qualification & 7; | 1962 | dr = exit_qualification & 7; |
1963 | reg = (exit_qualification >> 8) & 15; | 1963 | reg = (exit_qualification >> 8) & 15; |
1964 | vcpu_load_rsp_rip(vcpu); | 1964 | vcpu_load_rsp_rip(vcpu); |