Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/45743 )
Change subject: cpu: Check the KVM API version with a static_assert instead
of macros.
......................................................................
cpu: Check the KVM API version with a static_assert instead of macros.
Change-Id: Id8d52e25c4582ad802ee59facad5a1c31c2aa216
---
M src/cpu/kvm/vm.cc
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/cpu/kvm/vm.cc b/src/cpu/kvm/vm.cc
index e0a500c..13f774e 100644
--- a/src/cpu/kvm/vm.cc
+++ b/src/cpu/kvm/vm.cc
@@ -53,11 +53,14 @@
#include "params/KvmVM.hh"
#include "sim/system.hh"
-#define EXPECTED_KVM_API_VERSION 12
+namespace
+{
-#if EXPECTED_KVM_API_VERSION != KVM_API_VERSION
-#error Unsupported KVM version
-#endif
+constexpr int ExpectedKvmApiVersion = 12;
+static_assert(KVM_API_VERSION == ExpectedKvmApiVersion,
+ "Unsupported KVM version");
+
+} // anonymous namespace
Kvm *Kvm::instance = NULL;
@@ -75,7 +78,7 @@
fatal("KVM: Failed to open /dev/kvm\n");
apiVersion = ioctl(KVM_GET_API_VERSION);
- if (apiVersion != EXPECTED_KVM_API_VERSION)
+ if (apiVersion != ExpectedKvmApiVersion)
fatal("KVM: Incompatible API version\n");
vcpuMMapSize = ioctl(KVM_GET_VCPU_MMAP_SIZE);
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45743
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id8d52e25c4582ad802ee59facad5a1c31c2aa216
Gerrit-Change-Number: 45743
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s