2016-06-26 00:34:39 +02:00
|
|
|
static int opRDTSC(uint32_t fetchdat)
|
|
|
|
|
{
|
|
|
|
|
if (!cpu_hasrdtsc)
|
|
|
|
|
{
|
2016-08-20 03:40:12 +02:00
|
|
|
cpu_state.pc = cpu_state.oldpc;
|
2016-06-26 00:34:39 +02:00
|
|
|
x86illegal();
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if ((cr4 & CR4_TSD) && CPL)
|
|
|
|
|
{
|
|
|
|
|
x86gpf("RDTSC when TSD set and CPL != 0", 0);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
EAX = tsc & 0xffffffff;
|
|
|
|
|
EDX = tsc >> 32;
|
|
|
|
|
CLOCK_CYCLES(1);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int opRDPMC(uint32_t fetchdat)
|
|
|
|
|
{
|
|
|
|
|
if (ECX > 1 || (!(cr4 & CR4_PCE) && (cr0 & 1) && CPL))
|
|
|
|
|
{
|
|
|
|
|
x86gpf("RDPMC not allowed", 0);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
EAX = EDX = 0;
|
|
|
|
|
CLOCK_CYCLES(1);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|