From: Rico Amslinger Date: Tue, 13 Feb 2018 14:34:43 +0000 (+0100) Subject: mem, sim-se: Fixed seg-fault in EmulationPageTable::remap X-Git-Tag: v19.0.0.0~2300 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8da5e6b8b6fc1665edefffdf36c0aa7b9d53370d;p=gem5.git mem, sim-se: Fixed seg-fault in EmulationPageTable::remap When moving a memory region the target region should be unmapped. The assertion does reflect this, but the following line accesses the invalid pointer regardless. This commit replaces the pointer access with an emplace. Change-Id: I85f9be4e6c223eab447c75043e593ed3f90017e1 Reviewed-on: https://gem5-review.googlesource.com/8261 Reviewed-by: Gabe Black Reviewed-by: Brandon Potter Maintainer: Gabe Black --- diff --git a/src/mem/page_table.cc b/src/mem/page_table.cc index 8a11ada76..cd3422560 100644 --- a/src/mem/page_table.cc +++ b/src/mem/page_table.cc @@ -87,7 +87,7 @@ EmulationPageTable::remap(Addr vaddr, int64_t size, Addr new_vaddr) auto old_it = pTable.find(vaddr); assert(old_it != pTable.end() && new_it == pTable.end()); - new_it->second = old_it->second; + pTable.emplace(new_vaddr, old_it->second); pTable.erase(old_it); size -= pageSize; vaddr += pageSize;