rendered paste bodyvoid BX_CPU_C::RDTSC(bxInstruction_c *i)
{
#if BX_CPU_LEVEL >= 5
bx_bool tsd = BX_CPU_THIS_PTR cr4.get_TSD();
if ((tsd==0) || (tsd==1 && CPL==0)) {
// return ticks
Bit64u ticks = BX_CPU_THIS_PTR get_TSC();
RAX = (Bit32u) (ticks & 0xffffffff);
RDX = (Bit32u) ((ticks >> 32) & 0xffffffff);
} else {
// not allowed to use RDTSC!
BX_ERROR(("RDTSC: incorrect usage of RDTSC instruction !"));
exception(BX_GP_EXCEPTION, 0, 0);
}
#else
BX_INFO(("RDTSC: Pentium CPU required, use --enable-cpu=5"));
UndefinedOpcode(i);
#endif
}