summaryrefslogtreecommitdiff
path: root/src/sim/system.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2016-04-12 05:34:13 -0500
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-11-16 11:06:29 +0000
commit45b6179e4c70997616fb1c5fb806b1e48ee2d220 (patch)
tree26945fa056f620dd38bdbbd7fb10dcfe9479aec0 /src/sim/system.cc
parent1a551746a00501331ccde9eeb19a8fb5ca8982a2 (diff)
downloadgem5-45b6179e4c70997616fb1c5fb806b1e48ee2d220.tar.xz
sim: Add an option to load additional kernel objects
There are cases where it is desirable to load a kernel and a set of additional objects. This can, for example, be useful for testing where the bootstrap code can be loaded from one object (the kernel) and the test proper from another. This changeset adds this functionality by adding a kernel_extras vector parameter to the System class. Object files in this vector are loaded in order after the kernel when running in full system mode. Change-Id: I06f57c6a65a17b02eb4267bed0aa829f21bcfa3b Reviewed-on: https://gem5-review.googlesource.com/5703 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/sim/system.cc')
-rw-r--r--src/sim/system.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 42cd5e720..9d0b919ca 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -174,6 +174,14 @@ System::System(Params *p)
// Loading only needs to happen once and after memory system is
// connected so it will happen in initState()
}
+
+ for (const auto &obj_name : p->kernel_extras) {
+ inform("Loading additional kernel object: %s", obj_name);
+ ObjectFile *obj = createObjectFile(obj_name);
+ fatal_if(!obj, "Failed to additional kernel object '%s'.\n",
+ obj_name);
+ kernelExtras.push_back(obj);
+ }
}
// increment the number of running systems
@@ -312,6 +320,10 @@ System::initState()
}
// Load program sections into memory
kernel->loadSections(physProxy, loadAddrMask, loadAddrOffset);
+ for (const auto &extra_kernel : kernelExtras) {
+ extra_kernel->loadSections(physProxy, loadAddrMask,
+ loadAddrOffset);
+ }
DPRINTF(Loader, "Kernel start = %#x\n", kernelStart);
DPRINTF(Loader, "Kernel end = %#x\n", kernelEnd);