From fae00cb1755a80252f61f43551ef74f080dca7ec Mon Sep 17 00:00:00 2001 From: Matthew Poremba Date: Tue, 12 May 2020 09:56:07 -0500 Subject: [PATCH] sim: Fixes for mremap Remapping memory was trying to map old pages to the same new page and calling MemState mapRegion unnecessarily. Properly increment the new page address and remove the redundant mapRegion as remapRegion covers its functionality. JIRA: https://gem5.atlassian.net/browse/GEM5-475 Change-Id: Ie360755cfe488b09cbd87cd0ce525b11ac446b51 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28948 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/sim/mem_state.cc | 1 + src/sim/syscall_emul.hh | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sim/mem_state.cc b/src/sim/mem_state.cc index 42d37819f..f998fffe9 100644 --- a/src/sim/mem_state.cc +++ b/src/sim/mem_state.cc @@ -369,6 +369,7 @@ MemState::remapRegion(Addr start_addr, Addr new_start_addr, Addr length) new_start_addr); start_addr += _pageBytes; + new_start_addr += _pageBytes; /** * The regions need to always be page-aligned otherwise the while diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 5bd9f54f3..290c48e59 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -1177,7 +1177,6 @@ mremapFunc(SyscallDesc *desc, ThreadContext *tc, warn("returning %08p as start\n", new_start); p->memState->remapRegion(start, new_start, old_length); - p->memState->mapRegion(new_start, new_length, "remapped"); return new_start; } } -- 2.30.2