summaryrefslogtreecommitdiff
path: root/src/arch/arm
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/arm
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/arm')
-rw-r--r--src/arch/arm/linux/system.cc69
-rw-r--r--src/arch/arm/system.cc34
2 files changed, 52 insertions, 51 deletions
diff --git a/src/arch/arm/linux/system.cc b/src/arch/arm/linux/system.cc
index 4e18a265d..64bda4b4d 100644
--- a/src/arch/arm/linux/system.cc
+++ b/src/arch/arm/linux/system.cc
@@ -58,6 +58,40 @@ using namespace Linux;
LinuxArmSystem::LinuxArmSystem(Params *p)
: ArmSystem(p)
{
+#ifndef NDEBUG
+ kernelPanicEvent = addKernelFuncEvent<BreakPCEvent>("panic");
+ if (!kernelPanicEvent)
+ panic("could not find kernel symbol \'panic\'");
+#endif
+
+ // With ARM udelay() is #defined to __udelay
+ Addr addr = 0;
+ if (kernelSymtab->findAddress("__udelay", addr)) {
+ uDelaySkipEvent = new UDelayEvent(&pcEventQueue, "__udelay",
+ fixFuncEventAddr(addr), 1000, 0);
+ } else {
+ panic("couldn't find kernel symbol \'udelay\'");
+ }
+
+ // constant arguments to udelay() have some precomputation done ahead of
+ // time. Constant comes from code.
+ if (kernelSymtab->findAddress("__const_udelay", addr)) {
+ constUDelaySkipEvent = new UDelayEvent(&pcEventQueue, "__const_udelay",
+ fixFuncEventAddr(addr), 1000, 107374);
+ } else {
+ panic("couldn't find kernel symbol \'udelay\'");
+ }
+
+ secDataPtrAddr = 0;
+ secDataAddr = 0;
+ penReleaseAddr = 0;
+ kernelSymtab->findAddress("__secondary_data", secDataPtrAddr);
+ kernelSymtab->findAddress("secondary_data", secDataAddr);
+ kernelSymtab->findAddress("pen_release", penReleaseAddr);
+
+ secDataPtrAddr &= ~ULL(0x7F);
+ secDataAddr &= ~ULL(0x7F);
+ penReleaseAddr &= ~ULL(0x7F);
}
bool
@@ -116,41 +150,6 @@ LinuxArmSystem::initState()
physProxy.writeBlob(params()->atags_addr, boot_data, size << 2);
-#ifndef NDEBUG
- kernelPanicEvent = addKernelFuncEvent<BreakPCEvent>("panic");
- if (!kernelPanicEvent)
- panic("could not find kernel symbol \'panic\'");
-#endif
-
- // With ARM udelay() is #defined to __udelay
- Addr addr = 0;
- if (kernelSymtab->findAddress("__udelay", addr)) {
- uDelaySkipEvent = new UDelayEvent(&pcEventQueue, "__udelay",
- fixFuncEventAddr(addr), 1000, 0);
- } else {
- panic("couldn't find kernel symbol \'udelay\'");
- }
-
- // constant arguments to udelay() have some precomputation done ahead of
- // time. Constant comes from code.
- if (kernelSymtab->findAddress("__const_udelay", addr)) {
- constUDelaySkipEvent = new UDelayEvent(&pcEventQueue, "__const_udelay",
- fixFuncEventAddr(addr), 1000, 107374);
- } else {
- panic("couldn't find kernel symbol \'udelay\'");
- }
-
- secDataPtrAddr = 0;
- secDataAddr = 0;
- penReleaseAddr = 0;
- kernelSymtab->findAddress("__secondary_data", secDataPtrAddr);
- kernelSymtab->findAddress("secondary_data", secDataAddr);
- kernelSymtab->findAddress("pen_release", penReleaseAddr);
-
- secDataPtrAddr &= ~ULL(0x7F);
- secDataAddr &= ~ULL(0x7F);
- penReleaseAddr &= ~ULL(0x7F);
-
for (int i = 0; i < threadContexts.size(); i++) {
threadContexts[i]->setIntReg(0, 0);
threadContexts[i]->setIntReg(1, params()->machine_type);
diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc
index 8b85715cb..7fbabafcb 100644
--- a/src/arch/arm/system.cc
+++ b/src/arch/arm/system.cc
@@ -55,6 +55,19 @@ using namespace Linux;
ArmSystem::ArmSystem(Params *p)
: System(p), bootldr(NULL)
{
+ if ((p->boot_loader == "") != (p->boot_loader_mem == NULL))
+ fatal("If boot_loader is specifed, memory to load it must be also.\n");
+
+ if (p->boot_loader != "") {
+ bootldr = createObjectFile(p->boot_loader);
+
+ if (!bootldr)
+ fatal("Could not read bootloader: %s\n", p->boot_loader);
+
+ bootldr->loadGlobalSymbols(debugSymbolTable);
+
+ }
+ debugPrintkEvent = addKernelFuncEvent<DebugPrintkEvent>("dprintk");
}
void
@@ -68,17 +81,8 @@ ArmSystem::initState()
const Params* p = params();
- if ((p->boot_loader == "") != (p->boot_loader_mem == NULL))
- fatal("If boot_loader is specifed, memory to load it must be also.\n");
-
- if (p->boot_loader != "") {
- bootldr = createObjectFile(p->boot_loader);
-
- if (!bootldr)
- fatal("Could not read bootloader: %s\n", p->boot_loader);
-
+ if (bootldr) {
bootldr->loadSections(physProxy);
- bootldr->loadGlobalSymbols(debugSymbolTable);
uint8_t jump_to_bl[] =
{
@@ -87,32 +91,30 @@ ArmSystem::initState()
physProxy.writeBlob(0x0, jump_to_bl, sizeof(jump_to_bl));
inform("Using bootloader at address %#x\n", bootldr->entryPoint());
- }
- if (bootldr) {
// Put the address of the boot loader into r7 so we know
// where to branch to after the reset fault
// All other values needed by the boot loader to know what to do
+ if (!p->gic_cpu_addr || !p->flags_addr)
+ fatal("gic_cpu_addr && flags_addr must be set with bootloader\n");
+
for (int i = 0; i < threadContexts.size(); i++) {
threadContexts[i]->setIntReg(3, kernelEntry & loadAddrMask);
threadContexts[i]->setIntReg(4, params()->gic_cpu_addr);
threadContexts[i]->setIntReg(5, params()->flags_addr);
threadContexts[i]->setIntReg(7, bootldr->entryPoint());
}
- if (!p->gic_cpu_addr || !p->flags_addr)
- fatal("gic_cpu_addr && flags_addr must be set with bootloader\n");
} else {
// Set the initial PC to be at start of the kernel code
threadContexts[0]->pcState(kernelEntry & loadAddrMask);
}
+
for (int i = 0; i < threadContexts.size(); i++) {
if (p->midr_regval) {
threadContexts[i]->setMiscReg(ArmISA::MISCREG_MIDR,
p->midr_regval);
}
}
-
- debugPrintkEvent = addKernelFuncEvent<DebugPrintkEvent>("dprintk");
}
ArmSystem::~ArmSystem()