changeset 380375085863 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=380375085863
description:
        dev, arm: Make GenericTimer param handling more robust

        The generic timer needs a pointer to an ArmSystem to wire itself to the
        system register handler. This was previously specified as an instance
        of System that was later cast to ArmSystem. Make this more robust by
        specifying it as an ArmSystem in the Python interface and add a check
        to make sure that it is non-NULL.

        Change-Id: I989455e666f4ea324df28124edbbadfd094b0d02
        Signed-off-by: Andreas Sandberg <[email protected]>
        Reviewed-by: Nikos Nikoleris <[email protected]>

diffstat:

 src/dev/arm/RealView.py      |  2 +-
 src/dev/arm/generic_timer.cc |  3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r ebf2acd02fc5 -r 380375085863 src/dev/arm/RealView.py
--- a/src/dev/arm/RealView.py   Thu Oct 06 21:06:00 2016 -0400
+++ b/src/dev/arm/RealView.py   Fri Oct 07 14:14:44 2016 +0100
@@ -231,7 +231,7 @@
 class GenericTimer(SimObject):
     type = 'GenericTimer'
     cxx_header = "dev/arm/generic_timer.hh"
-    system = Param.System(Parent.any, "system")
+    system = Param.ArmSystem(Parent.any, "system")
     gic = Param.BaseGic(Parent.any, "GIC to use for interrupting")
     # @todo: for now only two timers per CPU is supported, which is the
     # normal behaviour when security extensions are disabled.
diff -r ebf2acd02fc5 -r 380375085863 src/dev/arm/generic_timer.cc
--- a/src/dev/arm/generic_timer.cc      Thu Oct 06 21:06:00 2016 -0400
+++ b/src/dev/arm/generic_timer.cc      Fri Oct 07 14:14:44 2016 +0100
@@ -234,7 +234,8 @@
       irqPhys(p->int_phys),
       irqVirt(p->int_virt)
 {
-    dynamic_cast<ArmSystem &>(*p->system).setGenericTimer(this);
+    fatal_if(!p->system, "No system specified, can't instantiate timer.\n");
+    p->system->setGenericTimer(this);
 }
 
 void
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to