#endif
}
+
+#if defined(__i386__) || defined(__x86_64__)
bool
Kvm::getSupportedCPUID(struct kvm_cpuid2 &cpuid) const
{
-#if defined(__i386__) || defined(__x86_64__)
if (ioctl(KVM_GET_SUPPORTED_CPUID, (void *)&cpuid) == -1) {
if (errno == E2BIG)
return false;
panic("KVM: Failed to get supported CPUID (errno: %i)\n", errno);
} else
return true;
-#else
- panic("KVM: getSupportedCPUID is unsupported on this platform.\n");
-#endif
}
const Kvm::CPUIDVector &
bool
Kvm::getSupportedMSRs(struct kvm_msr_list &msrs) const
{
-#if defined(__i386__) || defined(__x86_64__)
if (ioctl(KVM_GET_MSR_INDEX_LIST, (void *)&msrs) == -1) {
if (errno == E2BIG)
return false;
panic("KVM: Failed to get supported CPUID (errno: %i)\n", errno);
} else
return true;
-#else
- panic("KVM: getSupportedCPUID is unsupported on this platform.\n");
-#endif
}
const Kvm::MSRIndexVector &
return supportedMSRCache;
}
+#endif // x86-specific
+
+
int
Kvm::checkExtension(int extension) const
{
friend class KvmVM;
public:
- typedef std::vector<struct kvm_cpuid_entry2> CPUIDVector;
- typedef std::vector<uint32_t> MSRIndexVector;
-
virtual ~Kvm();
Kvm *create();
bool capXSave() const;
/** @} */
+#if defined(__i386__) || defined(__x86_64__)
+ public: // x86-specific
+ /**
+ * @{
+ * @name X86-specific APIs
+ */
+
+ typedef std::vector<struct kvm_cpuid_entry2> CPUIDVector;
+ typedef std::vector<uint32_t> MSRIndexVector;
+
/**
* Get the CPUID features supported by the hardware and Kvm.
*
*/
const MSRIndexVector &getSupportedMSRs() const;
+ private: // x86-specific
+ /** Cached vector of supported CPUID entries. */
+ mutable CPUIDVector supportedCPUIDCache;
+
+ /** Cached vector of supported MSRs. */
+ mutable MSRIndexVector supportedMSRCache;
+
+
+ /** @} */
+#endif
+
protected:
/**
* Check for the presence of an extension to the KVM API.
/** Size of the MMAPed vCPU parameter area. */
int vcpuMMapSize;
- /** Cached vector of supported CPUID entries. */
- mutable CPUIDVector supportedCPUIDCache;
-
- /** Cached vector of supported MSRs. */
- mutable MSRIndexVector supportedMSRCache;
-
/** Singleton instance */
static Kvm *instance;
};