fix rdtscp code

This commit is contained in:
Stanislav Shwartsman 2011-07-09 22:28:08 +00:00
parent 432bf97197
commit 28a58f4ea5

View File

@ -471,8 +471,23 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::RDTSCP(bxInstruction_c *i)
}
#endif
RDTSC(i);
RCX = MSR_TSC_AUX;
if (! BX_CPU_THIS_PTR cr4.get_TSD() || CPL==0) {
#if BX_SUPPORT_VMX
VMexit_RDTSC(i);
#endif
// return ticks
Bit64u ticks = BX_CPU_THIS_PTR get_TSC();
RAX = GET32L(ticks);
RDX = GET32H(ticks);
RCX = MSR_TSC_AUX;
} else {
BX_ERROR(("RDTSCP: not allowed to use instruction !"));
exception(BX_GP_EXCEPTION, 0);
}
#endif
BX_NEXT_INSTR(i);