]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Add rdpmc SVM intercept, by Bernhard Kauer.
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 9 Dec 2007 23:35:27 +0000 (23:35 +0000)
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 9 Dec 2007 23:35:27 +0000 (23:35 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3791 c046a42c-6fe2-441c-8c8c-71466251a162

target-i386/exec.h
target-i386/helper.c
target-i386/op.c
target-i386/translate.c

index 70fac64fc32aa0f2176abad99a7ab07e03794356..20153f7279cab6b4375a2d98f35e4e674503ffe3 100644 (file)
@@ -199,6 +199,7 @@ void helper_sysexit(void);
 void helper_syscall(int next_eip_addend);
 void helper_sysret(int dflag);
 void helper_rdtsc(void);
+void helper_rdpmc(void);
 void helper_rdmsr(void);
 void helper_wrmsr(void);
 void helper_lsl(void);
index a2f465c736462fb450202199338cc48f94d1940e..07ff3563cceb86717e28c7ba2f3a9e7d4bb0eb8c 100644 (file)
@@ -2743,6 +2743,18 @@ void helper_rdtsc(void)
     EDX = (uint32_t)(val >> 32);
 }
 
+void helper_rdpmc(void)
+{
+    if ((env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) {
+        raise_exception(EXCP0D_GPF);
+    }
+
+    if (!svm_check_intercept_param(SVM_EXIT_RDPMC, 0)) {
+        /* currently unimplemented */
+        raise_exception_err(EXCP06_ILLOP, 0);
+    }
+}
+
 #if defined(CONFIG_USER_ONLY)
 void helper_wrmsr(void)
 {
index 7d8950e0795f64db662daa571f2eb69d2953099d..77930db125e8952e3c8fa192bdb04f2fbd02a05e 100644 (file)
@@ -953,6 +953,11 @@ void OPPROTO op_rdtsc(void)
     helper_rdtsc();
 }
 
+void OPPROTO op_rdpmc(void)
+{
+    helper_rdpmc();
+}
+
 void OPPROTO op_cpuid(void)
 {
     helper_cpuid();
index 02dc6cf61cd4c94d432e88727d21cefb5bcbfab3..579831ef7a90f6bf0395bb5cb9a48646310231f3 100644 (file)
@@ -5658,6 +5658,10 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         gen_jmp_im(pc_start - s->cs_base);
         gen_op_rdtsc();
         break;
+    case 0x133: /* rdpmc */
+        gen_jmp_im(pc_start - s->cs_base);
+        gen_op_rdpmc();
+        break;
     case 0x134: /* sysenter */
         if (CODE64(s))
             goto illegal_op;