Deleted Added
sdiff udiff text old ( 12776:410b60d8a397 ) new ( 12779:c1dc175bb9be )
full compact
1/*
2 * Copyright (c) 2012, 2014, 2018 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

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

69#endif
70#endif
71
72using namespace std;
73
74PhysicalMemory::PhysicalMemory(const string& _name,
75 const vector<AbstractMemory*>& _memories,
76 bool mmap_using_noreserve) :
77 _name(_name), rangeCache(addrMap.end()), size(0),
78 mmapUsingNoReserve(mmap_using_noreserve)
79{
80 if (mmap_using_noreserve)
81 warn("Not reserving swap space. May cause SIGSEGV on actual usage\n");
82
83 // add the memories from the system to the address map as
84 // appropriate
85 for (const auto& m : _memories) {
86 // only add the memory if it is part of the global address map

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

231 // unmap the backing store
232 for (auto& s : backingStore)
233 munmap((char*)s.pmem, s.range.size());
234}
235
236bool
237PhysicalMemory::isMemAddr(Addr addr) const
238{
239 // see if the address is within the last matched range
240 if (rangeCache != addrMap.end() && rangeCache->first.contains(addr)) {
241 return true;
242 } else {
243 // lookup in the interval tree
244 const auto& r = addrMap.contains(addr);
245 if (r == addrMap.end()) {
246 // not in the cache, and not in the tree
247 return false;
248 }
249 // the range is in the tree, update the cache
250 rangeCache = r;
251 return true;
252 }
253}
254
255AddrRangeList
256PhysicalMemory::getConfAddrRanges() const
257{
258 // this could be done once in the constructor, but since it is unlikely to
259 // be called more than once the iteration should not be a problem
260 AddrRangeList ranges;

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

288 return ranges;
289}
290
291void
292PhysicalMemory::access(PacketPtr pkt)
293{
294 assert(pkt->isRequest());
295 Addr addr = pkt->getAddr();
296 if (rangeCache != addrMap.end() && rangeCache->first.contains(addr)) {
297 rangeCache->second->access(pkt);
298 } else {
299 // do not update the cache here, as we typically call
300 // isMemAddr before calling access
301 const auto& m = addrMap.contains(addr);
302 assert(m != addrMap.end());
303 m->second->access(pkt);
304 }
305}
306
307void
308PhysicalMemory::functionalAccess(PacketPtr pkt)
309{
310 assert(pkt->isRequest());
311 Addr addr = pkt->getAddr();
312 if (rangeCache != addrMap.end() && rangeCache->first.contains(addr)) {
313 rangeCache->second->functionalAccess(pkt);
314 } else {
315 // do not update the cache here, as we typically call
316 // isMemAddr before calling functionalAccess
317 const auto& m = addrMap.contains(addr);
318 assert(m != addrMap.end());
319 m->second->functionalAccess(pkt);
320 }
321}
322
323void
324PhysicalMemory::serialize(CheckpointOut &cp) const
325{
326 // serialize all the locked addresses and their context ids
327 vector<Addr> lal_addr;
328 vector<ContextID> lal_cid;

--- 154 unchanged lines hidden ---