/* Reads and returns the 64-bit MSR specified by Index. No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
/* Reads and returns the 64-bit MSR specified by Index. No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
{
  UINT32   LowData;
  UINT32   HighData;
  UINT64   Value;
  BOOLEAN  Flag;
  Flag = FilterBeforeMsrRead (Index, &Value);
  if (Flag) {
    __asm__ __volatile__ (
      "rdmsr"
      : "=a" (LowData),
        "=d" (HighData)
      : "c"  (Index)
    );
    Value = (((UINT64)HighData) << 32) | LowData;
  }
  FilterAfterMsrRead (Index, &Value);
  return Value;
}