tcg/i386: rdpmc: fix the the condtions
authorZheng Zhan Liang <linuxmaker@163.com>
Thu, 25 Feb 2021 05:47:57 +0000 (13:47 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 25 Feb 2021 14:41:53 +0000 (15:41 +0100)
Signed-off-by: Zheng Zhan Liang <linuxmaker@163.com>
Message-Id: <20210225054756.35962-1-linuxmaker@163.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/tcg/misc_helper.c

index f02e4fd40082225f92fd6f000df863f6135f3097..90b87fdef00395adda8472d1016f7795274a4d9b 100644 (file)
@@ -222,7 +222,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());