summaryrefslogtreecommitdiff
path: root/src/mem/abstract_mem.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-09-19 06:15:46 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-09-19 06:15:46 -0400
commita731f8f9dd62c80e4c927789afeb3a2efae4d64c (patch)
tree2b94d9e05d0ce0dd24322f8f83654c596c6fbebb /src/mem/abstract_mem.cc
parentffb6aec603c38e16ae91ea975c16fc3e8fb337e5 (diff)
downloadgem5-a731f8f9dd62c80e4c927789afeb3a2efae4d64c.tar.xz
Mem: Remove the file parameter from AbstractMemory
This patch removes the unused file parameter from the AbstractMemory. The patch serves to make it easier to transition to a separation of the actual contigious host memory backing store, and the gem5 memory controllers. Without the file parameter it becomes easier to hide the creation of the mmap in the PhysicalMemory, as there are no longer any reasons to expose the actual contigious ranges to the user. To the best of my knowledge there is no use of the parameter, so the change should not affect anyone.
Diffstat (limited to 'src/mem/abstract_mem.cc')
-rw-r--r--src/mem/abstract_mem.cc24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/mem/abstract_mem.cc b/src/mem/abstract_mem.cc
index ebe4a64b5..4d34bec80 100644
--- a/src/mem/abstract_mem.cc
+++ b/src/mem/abstract_mem.cc
@@ -76,29 +76,13 @@ AbstractMemory::AbstractMemory(const Params *p) :
if (params()->null)
return;
- if (params()->file == "") {
- int map_flags = MAP_ANON | MAP_PRIVATE;
- pmemAddr = (uint8_t *)mmap(NULL, size(),
- PROT_READ | PROT_WRITE, map_flags, -1, 0);
- } else {
- int map_flags = MAP_PRIVATE;
- int fd = open(params()->file.c_str(), O_RDONLY);
- long _size = lseek(fd, 0, SEEK_END);
- if (_size != range.size()) {
- fatal("Specified size %d does not match file %s %d\n",
- range.size(), params()->file, _size);
- }
- lseek(fd, 0, SEEK_SET);
- pmemAddr = (uint8_t *)mmap(NULL, roundUp(_size, sysconf(_SC_PAGESIZE)),
- PROT_READ | PROT_WRITE, map_flags, fd, 0);
- }
+ int map_flags = MAP_ANON | MAP_PRIVATE;
+ pmemAddr = (uint8_t *)mmap(NULL, size(),
+ PROT_READ | PROT_WRITE, map_flags, -1, 0);
if (pmemAddr == (void *)MAP_FAILED) {
perror("mmap");
- if (params()->file == "")
- fatal("Could not mmap!\n");
- else
- fatal("Could not find file: %s\n", params()->file);
+ fatal("Could not mmap!\n");
}
//If requested, initialize all the memory to 0