From 3ca404da175a66e0b958165ad75eb5f54cb5e772 Mon Sep 17 00:00:00 2001 From: Matthew Poremba Date: Wed, 17 Jun 2020 18:06:23 -0500 Subject: [PATCH] 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 --- src/sim/mem_state.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- 2.30.2