From dfd53d7573f88af4d363b1bedd3e803bd16edf8b Mon Sep 17 00:00:00 2001 From: Zheng Zhan Liang Date: Thu, 4 Mar 2021 18:50:33 -0500 Subject: [PATCH] tcg/i386: rdpmc: fix the the condtions Backports c45b426acd1ad8e30fbe1b9af8c07b2889c28c6b --- qemu/target/i386/misc_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu/target/i386/misc_helper.c b/qemu/target/i386/misc_helper.c index 71db8fb8..318dc1af 100644 --- a/qemu/target/i386/misc_helper.c +++ b/qemu/target/i386/misc_helper.c @@ -207,7 +207,8 @@ void helper_rdtscp(CPUX86State *env) void helper_rdpmc(CPUX86State *env) { - if ((env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) { + if (((env->cr[4] & CR4_PCE_MASK) == 0 ) && + ((env->hflags & HF_CPL_MASK) != 0)) { raise_exception_ra(env, EXCP0D_GPF, GETPC()); } cpu_svm_check_intercept_param(env, SVM_EXIT_RDPMC, 0, GETPC());