This patch provides a generic method for casting a System object
into an ArmSystem object. This is specially useful in dev-arm,
since devices by default obtain a generic System reference which
needs to be casted to use ArmSystem-specific functionality.
Change-Id: Ib100002413cb48cd93772dcf38f13be65badd1d3
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22426
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
}
}
+ArmSystem *
+ArmSystem::getArmSystem(System *sys)
+{
+ ArmSystem *a_sys = dynamic_cast<ArmSystem *>(sys);
+ assert(a_sys);
+ return a_sys;
+}
+
ArmSystem*
ArmSystem::getArmSystem(ThreadContext *tc)
{
/** Is Arm Semihosting support enabled? */
bool haveSemihosting() const { return semihosting != nullptr; }
+ /**
+ * Casts the provided System object into a valid ArmSystem, it fails
+ * otherwise.
+ * @param sys System object to cast
+ */
+ static ArmSystem *getArmSystem(System *sys);
+
/**
* Returns a valid ArmSystem pointer if using ARM ISA, it fails
* otherwise.