diff options
author | Gabe Black <gabeblack@google.com> | 2019-10-01 01:25:53 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-10-10 01:25:17 +0000 |
commit | a3d2a9ec92ad4406ccf51ff45a4a1d2aa16eaa69 (patch) | |
tree | 6ced63b62e070382a4c517bf63c0b4625a6aa433 /src/arch/sparc | |
parent | 70f66f77942872ace0af50170dcbb68ef2311095 (diff) | |
download | gem5-a3d2a9ec92ad4406ccf51ff45a4a1d2aa16eaa69.tar.xz |
arch, base: Stop assuming object files have three segments.
The ObjectFile class has hardcoded assumptions that there are three
segments, text, bss and data. There are some files which have one
"segment" like raw files, where the entire file's contents are
considered a single segment. There are also ELF files which can have
an arbitrary number of segments, and those segments can hold any
number of sections, including the text, data and/or bss sections.
Removing this assumption frees up some object file formats from having
to twist themselves to fit in that structure, possibly introducing
ambiguities when some segments may fulfill multiple roles.
Change-Id: I976e06a3a90ef852b17a6485e2595b006b2090d5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21463
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/arch/sparc')
-rw-r--r-- | src/arch/sparc/process.hh | 6 | ||||
-rw-r--r-- | src/arch/sparc/system.cc | 12 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/arch/sparc/process.hh b/src/arch/sparc/process.hh index eeb267116..f8f19f290 100644 --- a/src/arch/sparc/process.hh +++ b/src/arch/sparc/process.hh @@ -78,8 +78,7 @@ class Sparc32Process : public SparcProcess Sparc32Process(ProcessParams * params, ObjectFile *objFile) : SparcProcess(params, objFile, 0) { - Addr brk_point = objFile->dataBase() + objFile->dataSize() + - objFile->bssSize(); + Addr brk_point = objFile->maxSegmentAddr(); brk_point = roundUp(brk_point, SparcISA::PageBytes); // Reserve 8M for main stack. @@ -123,8 +122,7 @@ class Sparc64Process : public SparcProcess Sparc64Process(ProcessParams * params, ObjectFile *objFile) : SparcProcess(params, objFile, 2047) { - Addr brk_point = objFile->dataBase() + objFile->dataSize() + - objFile->bssSize(); + Addr brk_point = objFile->maxSegmentAddr(); brk_point = roundUp(brk_point, SparcISA::PageBytes); Addr max_stack_size = 8 * 1024 * 1024; diff --git a/src/arch/sparc/system.cc b/src/arch/sparc/system.cc index 5896061a6..e9615b00c 100644 --- a/src/arch/sparc/system.cc +++ b/src/arch/sparc/system.cc @@ -137,22 +137,22 @@ SparcSystem::initState() System::initState(); // Load reset binary into memory - reset->setTextBase(params()->reset_addr); + reset->setLoadOffset(params()->reset_addr); reset->loadSegments(physProxy); // Load the openboot binary - openboot->setTextBase(params()->openboot_addr); + openboot->setLoadOffset(params()->openboot_addr); openboot->loadSegments(physProxy); // Load the hypervisor binary - hypervisor->setTextBase(params()->hypervisor_addr); + hypervisor->setLoadOffset(params()->hypervisor_addr); hypervisor->loadSegments(physProxy); // Load the nvram image - nvram->setTextBase(params()->nvram_addr); + nvram->setLoadOffset(params()->nvram_addr); nvram->loadSegments(physProxy); // Load the hypervisor description image - hypervisor_desc->setTextBase(params()->hypervisor_desc_addr); + hypervisor_desc->setLoadOffset(params()->hypervisor_desc_addr); hypervisor_desc->loadSegments(physProxy); // Load the partition description image - partition_desc->setTextBase(params()->partition_desc_addr); + partition_desc->setLoadOffset(params()->partition_desc_addr); partition_desc->loadSegments(physProxy); |