Skip to content

Commit f3ffce4

Browse files
binbinwu1acrnsi
authored andcommitted
hv: vmexit: ecx should be checked instead of rcx when xsetbv
According to SDM, xsetbv writes the contents of registers EDX:EAX into the 64-bit extended control register (XCR) specified in the ECX register. (On processors that support the Intel 64 architecture, the high-order 32 bits of RCX are ignored.) In current code, RCX is checked, should ingore the high-order 32bits. Tracked-On: #3360 Signed-off-by: Binbin Wu <binbin.wu@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
1 parent e837116 commit f3ffce4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hypervisor/arch/x86/guest/vmexit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ static int32_t xsetbv_vmexit_handler(struct acrn_vcpu *vcpu)
306306
if (idx >= NR_WORLD) {
307307
ret = -1;
308308
} else {
309-
/* to access XCR0,'rcx' should be 0 */
310-
if (vcpu_get_gpreg(vcpu, CPU_REG_RCX) != 0UL) {
309+
/* to access XCR0,'ecx' should be 0 */
310+
if ((vcpu_get_gpreg(vcpu, CPU_REG_RCX) & 0xffffffffUL) != 0UL) {
311311
vcpu_inject_gp(vcpu, 0U);
312312
} else {
313313
val64 = (vcpu_get_gpreg(vcpu, CPU_REG_RAX) & 0xffffffffUL) |

0 commit comments

Comments
 (0)