summaryrefslogtreecommitdiff
path: root/src/arch/alpha
diff options
context:
space:
mode:
authorAli Saidi <Ali.Saidi@ARM.com>2012-03-09 09:59:26 -0500
committerAli Saidi <Ali.Saidi@ARM.com>2012-03-09 09:59:26 -0500
commit3ce2d0fad04201b168dd9847a5120c80408f6498 (patch)
tree76c86f659e55295c3b9d85b3d424bf8fa3b35765 /src/arch/alpha
parentec1ef24895de75e8408398492ee8190866650bb5 (diff)
downloadgem5-3ce2d0fad04201b168dd9847a5120c80408f6498.tar.xz
System: Move code in initState() back into constructor whenever possible.
The change to port proxies recently moved code out of the constructor into initState(). This is needed for code that loads data into memory, however for code that setups symbol tables, kernel based events, etc this is the wrong thing to do as that code is only called when a checkpoint isn't being restored from.
Diffstat (limited to 'src/arch/alpha')
-rw-r--r--src/arch/alpha/linux/system.cc7
-rw-r--r--src/arch/alpha/linux/system.hh6
-rw-r--r--src/arch/alpha/system.cc70
-rw-r--r--src/arch/alpha/system.hh10
4 files changed, 69 insertions, 24 deletions
diff --git a/src/arch/alpha/linux/system.cc b/src/arch/alpha/linux/system.cc
index e42553b63..db3c16d7e 100644
--- a/src/arch/alpha/linux/system.cc
+++ b/src/arch/alpha/linux/system.cc
@@ -113,6 +113,12 @@ LinuxAlphaSystem::initState()
else
panic("could not find dp264_mv\n");
+}
+
+void
+LinuxAlphaSystem::setupFuncEvents()
+{
+ AlphaSystem::setupFuncEvents();
#ifndef NDEBUG
kernelPanicEvent = addKernelFuncEvent<BreakPCEvent>("panic");
if (!kernelPanicEvent)
@@ -148,6 +154,7 @@ LinuxAlphaSystem::initState()
// re-enable, but we should find a better way to turn it on than
// using DTRACE(Thread), since looking at a trace flag at tick 0
// leads to non-intuitive behavior with --trace-start.
+ Addr addr = 0;
if (false && kernelSymtab->findAddress("alpha_switch_to", addr)) {
printThreadEvent = new PrintThreadInfo(&pcEventQueue, "threadinfo",
addr + sizeof(MachInst) * 6);
diff --git a/src/arch/alpha/linux/system.hh b/src/arch/alpha/linux/system.hh
index 5436a27b2..345c17bb7 100644
--- a/src/arch/alpha/linux/system.hh
+++ b/src/arch/alpha/linux/system.hh
@@ -123,6 +123,12 @@ class LinuxAlphaSystem : public AlphaSystem
/** Grab the PCBB of the idle process when it starts */
IdleStartEvent *idleStartEvent;
+ protected:
+ /** Setup all the function events. Must be done after init() for Alpha since
+ * fixFuncEvent() requires a function port
+ */
+ virtual void setupFuncEvents();
+
public:
typedef LinuxAlphaSystemParams Params;
LinuxAlphaSystem(Params *p);
diff --git a/src/arch/alpha/system.cc b/src/arch/alpha/system.cc
index 8d6629169..51e1d7e07 100644
--- a/src/arch/alpha/system.cc
+++ b/src/arch/alpha/system.cc
@@ -63,6 +63,27 @@ AlphaSystem::AlphaSystem(Params *p)
pal = createObjectFile(params()->pal);
if (pal == NULL)
fatal("Could not load PALcode file %s", params()->pal);
+
+ // load symbols
+ if (!console->loadGlobalSymbols(consoleSymtab))
+ panic("could not load console symbols\n");
+
+ if (!pal->loadGlobalSymbols(palSymtab))
+ panic("could not load pal symbols\n");
+
+ if (!pal->loadLocalSymbols(palSymtab))
+ panic("could not load pal symbols\n");
+
+ if (!console->loadGlobalSymbols(debugSymbolTable))
+ panic("could not load console symbols\n");
+
+ if (!pal->loadGlobalSymbols(debugSymbolTable))
+ panic("could not load pal symbols\n");
+
+ if (!pal->loadLocalSymbols(debugSymbolTable))
+ panic("could not load pal symbols\n");
+
+
}
AlphaSystem::~AlphaSystem()
@@ -78,6 +99,8 @@ AlphaSystem::~AlphaSystem()
void
AlphaSystem::initState()
{
+ Addr addr = 0;
+
// Moved from the constructor to here since it relies on the
// address map being resolved in the interconnect
@@ -88,30 +111,6 @@ AlphaSystem::initState()
pal->loadSections(physProxy, loadAddrMask);
console->loadSections(physProxy, loadAddrMask);
- // load symbols
- if (!console->loadGlobalSymbols(consoleSymtab))
- panic("could not load console symbols\n");
-
- if (!pal->loadGlobalSymbols(palSymtab))
- panic("could not load pal symbols\n");
-
- if (!pal->loadLocalSymbols(palSymtab))
- panic("could not load pal symbols\n");
-
- if (!console->loadGlobalSymbols(debugSymbolTable))
- panic("could not load console symbols\n");
-
- if (!pal->loadGlobalSymbols(debugSymbolTable))
- panic("could not load pal symbols\n");
-
- if (!pal->loadLocalSymbols(debugSymbolTable))
- panic("could not load pal symbols\n");
-
- Addr addr = 0;
-#ifndef NDEBUG
- consolePanicEvent = addConsoleFuncEvent<BreakPCEvent>("panic");
-#endif
-
/**
* Copy the osflags (kernel arguments) into the consoles
* memory. (Presently Linux does not use the console service
@@ -135,6 +134,29 @@ AlphaSystem::initState()
virtProxy.write(addr+0x58, data);
} else
panic("could not find hwrpb\n");
+
+ // Setup all the function events now that we have a system and a symbol
+ // table
+ setupFuncEvents();
+}
+
+void
+AlphaSystem::loadState(Checkpoint *cp)
+{
+ System::loadState(cp);
+
+ // Setup all the function events now that we have a system and a symbol
+ // table
+ setupFuncEvents();
+
+}
+
+void
+AlphaSystem::setupFuncEvents()
+{
+#ifndef NDEBUG
+ consolePanicEvent = addConsoleFuncEvent<BreakPCEvent>("panic");
+#endif
}
/**
diff --git a/src/arch/alpha/system.hh b/src/arch/alpha/system.hh
index 0e809cb94..d832dfe77 100644
--- a/src/arch/alpha/system.hh
+++ b/src/arch/alpha/system.hh
@@ -62,6 +62,10 @@ class AlphaSystem : public System
virtual void serialize(std::ostream &os);
virtual void unserialize(Checkpoint *cp, const std::string &section);
+ /** Override loadState to provide a path to call setupFuncEvents()
+ */
+ virtual void loadState(Checkpoint *cp);
+
/**
* Set the m5AlphaAccess pointer in the console
*/
@@ -89,6 +93,12 @@ class AlphaSystem : public System
const Params *params() const { return (const Params *)_params; }
+
+ /** Setup all the function events. Must be done after init() for Alpha since
+ * fixFuncEvent() requires a function port
+ */
+ virtual void setupFuncEvents();
+
/** Add a function-based event to PALcode. */
template <class T>
T *