summaryrefslogtreecommitdiff
path: root/src/arch/arm
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-10-01 01:25:53 -0700
committerGabe Black <gabeblack@google.com>2019-10-10 01:25:17 +0000
commita3d2a9ec92ad4406ccf51ff45a4a1d2aa16eaa69 (patch)
tree6ced63b62e070382a4c517bf63c0b4625a6aa433 /src/arch/arm
parent70f66f77942872ace0af50170dcbb68ef2311095 (diff)
downloadgem5-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/arm')
-rw-r--r--src/arch/arm/freebsd/system.cc2
-rw-r--r--src/arch/arm/linux/system.cc2
-rw-r--r--src/arch/arm/process.cc6
3 files changed, 4 insertions, 6 deletions
diff --git a/src/arch/arm/freebsd/system.cc b/src/arch/arm/freebsd/system.cc
index 6e544a70e..764f036b4 100644
--- a/src/arch/arm/freebsd/system.cc
+++ b/src/arch/arm/freebsd/system.cc
@@ -132,7 +132,7 @@ FreebsdArmSystem::initState()
if (ra)
bootReleaseAddr = ra & ~ULL(0x7F);
- dtb_file->setTextBase(params()->atags_addr + loadAddrOffset);
+ dtb_file->setLoadOffset(params()->atags_addr + loadAddrOffset);
dtb_file->loadSegments(physProxy);
delete dtb_file;
diff --git a/src/arch/arm/linux/system.cc b/src/arch/arm/linux/system.cc
index f03a5c6cb..a0869b46a 100644
--- a/src/arch/arm/linux/system.cc
+++ b/src/arch/arm/linux/system.cc
@@ -151,7 +151,7 @@ LinuxArmSystem::initState()
"to DTB file: %s\n", params()->dtb_filename);
}
- dtb_file->setTextBase(params()->atags_addr + loadAddrOffset);
+ dtb_file->setLoadOffset(params()->atags_addr + loadAddrOffset);
dtb_file->loadSegments(physProxy);
delete dtb_file;
} else {
diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc
index 1a1d4a2a0..f98572690 100644
--- a/src/arch/arm/process.cc
+++ b/src/arch/arm/process.cc
@@ -75,8 +75,7 @@ ArmProcess32::ArmProcess32(ProcessParams *params, ObjectFile *objFile,
ObjectFile::Arch _arch)
: ArmProcess(params, objFile, _arch)
{
- Addr brk_point = roundUp(objFile->dataBase() + objFile->dataSize() +
- objFile->bssSize(), PageBytes);
+ Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes);
Addr stack_base = 0xbf000000L;
Addr max_stack_size = 8 * 1024 * 1024;
Addr next_thread_stack_base = stack_base - max_stack_size;
@@ -90,8 +89,7 @@ ArmProcess64::ArmProcess64(ProcessParams *params, ObjectFile *objFile,
ObjectFile::Arch _arch)
: ArmProcess(params, objFile, _arch)
{
- Addr brk_point = roundUp(objFile->dataBase() + objFile->dataSize() +
- objFile->bssSize(), PageBytes);
+ Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes);
Addr stack_base = 0x7fffff0000L;
Addr max_stack_size = 8 * 1024 * 1024;
Addr next_thread_stack_base = stack_base - max_stack_size;