summaryrefslogtreecommitdiff
path: root/src/sim/system.cc
diff options
context:
space:
mode:
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");