summaryrefslogtreecommitdiff
path: root/src/arch/riscv
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/riscv
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/riscv')
-rw-r--r--src/arch/riscv/process.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/arch/riscv/process.cc b/src/arch/riscv/process.cc
index ca3f0e2b8..e15197d78 100644
--- a/src/arch/riscv/process.cc
+++ b/src/arch/riscv/process.cc
@@ -75,8 +75,7 @@ RiscvProcess64::RiscvProcess64(ProcessParams *params, ObjectFile *objFile) :
const Addr stack_base = 0x7FFFFFFFFFFFFFFFL;
const Addr max_stack_size = 8 * 1024 * 1024;
const Addr next_thread_stack_base = stack_base - max_stack_size;
- const Addr brk_point = roundUp(objFile->bssBase() + objFile->bssSize(),
- PageBytes);
+ const Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes);
const Addr mmap_end = 0x4000000000000000L;
memState = make_shared<MemState>(brk_point, stack_base, max_stack_size,
next_thread_stack_base, mmap_end);
@@ -88,8 +87,7 @@ RiscvProcess32::RiscvProcess32(ProcessParams *params, ObjectFile *objFile) :
const Addr stack_base = 0x7FFFFFFF;
const Addr max_stack_size = 8 * 1024 * 1024;
const Addr next_thread_stack_base = stack_base - max_stack_size;
- const Addr brk_point = roundUp(objFile->bssBase() + objFile->bssSize(),
- PageBytes);
+ const Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes);
const Addr mmap_end = 0x40000000L;
memState = make_shared<MemState>(brk_point, stack_base, max_stack_size,
next_thread_stack_base, mmap_end);