summaryrefslogtreecommitdiff
path: root/src/sim/system.cc
diff options
context:
space:
mode:
authorGeoffrey Blake <Geoffrey.Blake@arm.com>2016-05-12 11:47:43 -0500
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-11-17 10:54:24 +0000
commit62ae85c0a2db286bcf1c8df5ad8f97a8bd527a55 (patch)
tree611493f08e164caad33b067b30f7134bcb598684 /src/sim/system.cc
parent463a4bb6cdaa16e22a4302bbc6301c6d90e524c8 (diff)
downloadgem5-62ae85c0a2db286bcf1c8df5ad8f97a8bd527a55.tar.xz
sim: Implement load_addr_mask auto-calculation
Recent Linux kernels for AArch64 have changed their start addresses but we still want to relocate the kernel to 0x80080000 which required hacking the load_addr_mask in Realview.py to be 0x7ffffff from 0xfffffff to mask off the proper number of MSBs to load the kernel in the desired location. To avoid having to make this change in the future again, we auto-calculate the load_addr_mask if it is specified as 0x0 in the System sim-object to find the most restrictive address mask instead of having the configuration specify it. If the configuration does specify the address mask, we use it instead of auto-calculating. Change-Id: I18aabb5d09945c6e3e3819c9c8036ea24b6c35cf Signed-off-by: Geoffrey Blake <Geoffrey.Blake@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2323 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/sim/system.cc')
-rw-r--r--src/sim/system.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 9d0b919ca..e720db07a 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014 ARM Limited
+ * Copyright (c) 2011-2014,2017 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -158,6 +158,14 @@ System::System(Params *p)
kernelEnd = kernel->bssBase() + kernel->bssSize();
kernelEntry = kernel->entryPoint();
+ // If load_addr_mask is set to 0x0, then auto-calculate
+ // the smallest mask to cover all kernel addresses so gem5
+ // can relocate the kernel to a new offset.
+ if (loadAddrMask == 0) {
+ Addr shift_amt = findMsbSet(kernelEnd - kernelStart) + 1;
+ loadAddrMask = ((Addr)1 << shift_amt) - 1;
+ }
+
// load symbols
if (!kernel->loadGlobalSymbols(kernelSymtab))
fatal("could not load kernel symbols\n");