All pastes #547054 Raw Edit

Something

public cpp v1 · immutable
·published 2007-06-07 07:52 UTC
rendered paste body
void BX_CPU_C::RDPMC(bxInstruction_c *i){/* We need to be Pentium with MMX or later */#if ((BX_CPU_LEVEL >= 6) || (BX_SUPPORT_MMX && BX_CPU_LEVEL == 5))  bx_bool pce = BX_CPU_THIS_PTR cr4.get_PCE();  if ((pce==1) || (CPL==0) || real_mode())  {    /* According to manual, Pentium 4 has 18 counters,     * previous versions have two.  And the P4 also can do     * short read-out (EDX always 0).  Otherwise it is     * limited to 40 bits.     */#if (BX_CPU_LEVEL == 6 && BX_SUPPORT_SSE >= 2) // Pentium 4 processor (see cpuid.cc)    if ((ECX & 0x7fffffff) >= 18)      exception(BX_GP_EXCEPTION, 0, 0);#else //    if ((ECX & 0xffffffff) >= 2)      exception(BX_GP_EXCEPTION, 0, 0);#endif    // Most counters are for hardware specific details, which    // we anyhow do not emulate (like pipeline stalls etc)    // Could be interesting to count number of memory reads,    // writes.  Misaligned etc...  But to monitor bochs, this    // is easier done from the host.    EAX = 0;    EDX = 0; // if P4 and ECX & 0x10000000, then always 0 (short read 32 bits)    BX_ERROR(("RDPMC: Performance Counters Support not reasonably implemented yet"));  } else {    // not allowed to use RDPMC!    exception(BX_GP_EXCEPTION, 0, 0);  }#else  UndefinedOpcode(i);#endif}