From: Matthew Poremba Date: Wed, 17 Jun 2020 23:06:23 +0000 (-0500) Subject: sim: Initialize stackSize and stackMin in MemState X-Git-Tag: v20.1.0.0~567 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3ca404da175a66e0b958165ad75eb5f54cb5e772;p=gem5.git sim: Initialize stackSize and stackMin in MemState Initialize _stackSize and _stackMin to the maximum stack size values. The are setup in each arch's Process::initState and may be uninitialized until then. If a stack fixup occurs before these are setup, addresses which are not in the stack might be allocated on the stack. This prevents that until they are initialized in Process::initState. If an access occurs before that with these initial values, the stack fixup will simply allocate a page of memory in the stack space. However, it will not print the typical info messages about growing the stack during this time. Change-Id: I9f9316734f4bf1f773fc538922e83b867731c684 JIRA: https://gem5.atlassian.net/browse/GEM5-629 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30394 Reviewed-by: Jason Lowe-Power Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/src/sim/mem_state.cc b/src/sim/mem_state.cc index bfee9dab5..bcfab7859 100644 --- a/src/sim/mem_state.cc +++ b/src/sim/mem_state.cc @@ -43,7 +43,8 @@ MemState::MemState(Process *owner, Addr brk_point, Addr stack_base, Addr mmap_end) : _ownerProcess(owner), _pageBytes(owner->system->getPageBytes()), _brkPoint(brk_point), - _stackBase(stack_base), _maxStackSize(max_stack_size), + _stackBase(stack_base), _stackSize(max_stack_size), + _maxStackSize(max_stack_size), _stackMin(stack_base - max_stack_size), _nextThreadStackBase(next_thread_stack_base), _mmapEnd(mmap_end), _endBrkPoint(brk_point) {