From 3c7861ff06d06a0d999eed4047e67e6604e09960 Mon Sep 17 00:00:00 2001 From: Richard Hellwig Date: Tue, 14 Jan 2014 13:07:21 +0100 Subject: [PATCH] core/sal: Added features that indicate whether FAIL* is initialized GEM5 throws a reset trap during initialization. This happens before the startup function is called. This leads to problems because the startup function fills the m_CPUs list. m_CPUs is needed for the TrapListener. Therefore, we only react on traps after initialization. This is needed in the following commit (see gem5/src/arch/arm/faults.cc). Change-Id: I9ec6fd453705feb54b4f8a87d024181323a2d7ef --- src/core/sal/SimulatorController.cc | 3 +++ src/core/sal/SimulatorController.hpp | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/sal/SimulatorController.cc b/src/core/sal/SimulatorController.cc index be5d9864..1d121d27 100644 --- a/src/core/sal/SimulatorController.cc +++ b/src/core/sal/SimulatorController.cc @@ -50,6 +50,9 @@ void SimulatorController::startup() std::cout << "[SimulatorController] Initializing..." << std::endl; // TODO: Log-Level? + // Set Fail* as initialized + m_isInitialized = true; + // Activate previously added experiments to allow initialization: initExperiments(); } diff --git a/src/core/sal/SimulatorController.hpp b/src/core/sal/SimulatorController.hpp index fd08aeec..d526616e 100644 --- a/src/core/sal/SimulatorController.hpp +++ b/src/core/sal/SimulatorController.hpp @@ -34,14 +34,15 @@ class MemoryManager; */ class SimulatorController { protected: + bool m_isInitialized; ListenerManager m_LstList; //!< storage where listeners are being buffered CoroutineManager m_Flows; //!< managed experiment flows MemoryManager *m_Mem; //!< access to memory pool std::vector m_CPUs; //!< list of CPUs in the target system friend class ListenerManager; //!< "outsources" the listener management public: - SimulatorController() : m_Mem(NULL) { } - SimulatorController(MemoryManager* mem) : m_Mem(mem) { } + SimulatorController() : m_isInitialized(false), m_Mem(NULL) { } + SimulatorController(MemoryManager* mem) : m_isInitialized(false), m_Mem(mem) { } virtual ~SimulatorController() { } /** * @brief Initialization function each implementation needs to call on @@ -251,6 +252,11 @@ public: * @see SimulatorController::getTimerTicks() */ virtual simtime_t getTimerTicksPerSecond() { return 0; } + /** + * Returns whether FAIL* has already been initialized. + * @return A Boolean, indicating whether FAIL* has been initialized. + */ + bool isInitialized() { return m_isInitialized; } }; } // end-of-namespace: fail