physical.cc (9565:c2f393be5f14) physical.cc (9707:1305bec2733f)
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 148 unchanged lines hidden (view full) ---

157 fatal("Could not mmap %d bytes for range %s!\n", range.size(),
158 range.to_string());
159 }
160
161 // remember this backing store so we can checkpoint it and unmap
162 // it appropriately
163 backingStore.push_back(make_pair(range, pmem));
164
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 148 unchanged lines hidden (view full) ---

157 fatal("Could not mmap %d bytes for range %s!\n", range.size(),
158 range.to_string());
159 }
160
161 // remember this backing store so we can checkpoint it and unmap
162 // it appropriately
163 backingStore.push_back(make_pair(range, pmem));
164
165 // count how many of the memories are to be zero initialized so we
166 // can see if some but not all have this parameter set
167 uint32_t init_to_zero = 0;
168
169 // point the memories to their backing store, and if requested,
170 // initialize the memory range to 0
171 for (vector<AbstractMemory*>::const_iterator m = _memories.begin();
172 m != _memories.end(); ++m) {
173 DPRINTF(BusAddrRanges, "Mapping memory %s to backing store\n",
174 (*m)->name());
175 (*m)->setBackingStore(pmem);
165 // point the memories to their backing store, and if requested,
166 // initialize the memory range to 0
167 for (vector<AbstractMemory*>::const_iterator m = _memories.begin();
168 m != _memories.end(); ++m) {
169 DPRINTF(BusAddrRanges, "Mapping memory %s to backing store\n",
170 (*m)->name());
171 (*m)->setBackingStore(pmem);
176
177 // if it should be zero, then go and make it so
178 if ((*m)->initToZero()) {
179 ++init_to_zero;
180 }
181 }
172 }
182
183 if (init_to_zero != 0) {
184 if (init_to_zero != _memories.size())
185 fatal("Some, but not all memories in range %s are set zero\n",
186 range.to_string());
187
188 memset(pmem, 0, range.size());
189 }
190}
191
192PhysicalMemory::~PhysicalMemory()
193{
194 // unmap the backing store
195 for (vector<pair<AddrRange, uint8_t*> >::iterator s = backingStore.begin();
196 s != backingStore.end(); ++s)
197 munmap((char*)s->second, s->first.size());

--- 269 unchanged lines hidden ---
173}
174
175PhysicalMemory::~PhysicalMemory()
176{
177 // unmap the backing store
178 for (vector<pair<AddrRange, uint8_t*> >::iterator s = backingStore.begin();
179 s != backingStore.end(); ++s)
180 munmap((char*)s->second, s->first.size());

--- 269 unchanged lines hidden ---