mem: Optionally share the backing store

This patch adds the ability for a host-OS process external to gem5
to access the backing store via POSIX shared memory.
The new param shared_backstore of the System object is the filename
of the shared memory (i.e., the first argument to shm_open()).

Change-Id: I98c948a32a15049a4515e6c02a14595fb5fe379f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30994
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Boris Shingarov
2020-03-08 12:37:16 -04:00
committed by Boris Shingarov
parent cc3e12b504
commit f7e5985e7b
4 changed files with 32 additions and 6 deletions

View File

@@ -78,6 +78,10 @@ class System(SimObject):
# I/O bridge or cache
mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
shared_backstore = Param.String("", "backstore's shmem segment filename, "
"use to directly address the backstore from another host-OS process. "
"Leave this empty to unset the MAP_SHARED flag.")
cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
redirect_paths = VectorParam.RedirectPath([], "Path redirections")

View File

@@ -213,7 +213,8 @@ System::System(Params *p)
#else
kvmVM(nullptr),
#endif
physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve),
physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve,
p->shared_backstore),
memoryMode(p->mem_mode),
_cacheLineSize(p->cache_line_size),
workItemsBegin(0),