Commit df01e0fc33af5b1247d8ac4bfec5b94466ff69c2

Authored by balrog
1 parent 8543243c

Add rdpmc SVM intercept, by Bernhard Kauer.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3791 c046a42c-6fe2-441c-8c8c-71466251a162
target-i386/exec.h
... ... @@ -199,6 +199,7 @@ void helper_sysexit(void);
199 199 void helper_syscall(int next_eip_addend);
200 200 void helper_sysret(int dflag);
201 201 void helper_rdtsc(void);
  202 +void helper_rdpmc(void);
202 203 void helper_rdmsr(void);
203 204 void helper_wrmsr(void);
204 205 void helper_lsl(void);
... ...
target-i386/helper.c
... ... @@ -2743,6 +2743,18 @@ void helper_rdtsc(void)
2743 2743 EDX = (uint32_t)(val >> 32);
2744 2744 }
2745 2745  
  2746 +void helper_rdpmc(void)
  2747 +{
  2748 + if ((env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) {
  2749 + raise_exception(EXCP0D_GPF);
  2750 + }
  2751 +
  2752 + if (!svm_check_intercept_param(SVM_EXIT_RDPMC, 0)) {
  2753 + /* currently unimplemented */
  2754 + raise_exception_err(EXCP06_ILLOP, 0);
  2755 + }
  2756 +}
  2757 +
2746 2758 #if defined(CONFIG_USER_ONLY)
2747 2759 void helper_wrmsr(void)
2748 2760 {
... ...
target-i386/op.c
... ... @@ -953,6 +953,11 @@ void OPPROTO op_rdtsc(void)
953 953 helper_rdtsc();
954 954 }
955 955  
  956 +void OPPROTO op_rdpmc(void)
  957 +{
  958 + helper_rdpmc();
  959 +}
  960 +
956 961 void OPPROTO op_cpuid(void)
957 962 {
958 963 helper_cpuid();
... ...
target-i386/translate.c
... ... @@ -5658,6 +5658,10 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
5658 5658 gen_jmp_im(pc_start - s->cs_base);
5659 5659 gen_op_rdtsc();
5660 5660 break;
  5661 + case 0x133: /* rdpmc */
  5662 + gen_jmp_im(pc_start - s->cs_base);
  5663 + gen_op_rdpmc();
  5664 + break;
5661 5665 case 0x134: /* sysenter */
5662 5666 if (CODE64(s))
5663 5667 goto illegal_op;
... ...