misc: Move AddrRangeList from port.hh to addr_range.hh
The new location seems like a better fit. The iterator typedefs are removed in favour of using C++11 auto.
This commit is contained in:
parent
e6ad39adac
commit
edc77fc03c
|
@ -45,6 +45,7 @@
|
||||||
#ifndef __BASE_ADDR_RANGE_HH__
|
#ifndef __BASE_ADDR_RANGE_HH__
|
||||||
#define __BASE_ADDR_RANGE_HH__
|
#define __BASE_ADDR_RANGE_HH__
|
||||||
|
|
||||||
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/bitfield.hh"
|
#include "base/bitfield.hh"
|
||||||
|
@ -293,6 +294,11 @@ class AddrRange
|
||||||
#endif // SWIG
|
#endif // SWIG
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience typedef for a collection of address ranges
|
||||||
|
*/
|
||||||
|
typedef std::list<AddrRange> AddrRangeList;
|
||||||
|
|
||||||
inline AddrRange
|
inline AddrRange
|
||||||
RangeEx(Addr start, Addr end)
|
RangeEx(Addr start, Addr end)
|
||||||
{ return AddrRange(start, end - 1); }
|
{ return AddrRange(start, end - 1); }
|
||||||
|
|
|
@ -57,15 +57,14 @@ BadAddrEvent::process(ThreadContext *tc)
|
||||||
|
|
||||||
uint64_t a0 = tc->readIntReg(16);
|
uint64_t a0 = tc->readIntReg(16);
|
||||||
|
|
||||||
AddrRangeIter iter;
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
MasterPort &dataPort = tc->getCpuPtr()->getDataPort();
|
MasterPort &dataPort = tc->getCpuPtr()->getDataPort();
|
||||||
|
|
||||||
// get the address ranges of the connected slave port
|
// get the address ranges of the connected slave port
|
||||||
AddrRangeList resp = dataPort.getAddrRanges();
|
AddrRangeList resp = dataPort.getAddrRanges();
|
||||||
for (iter = resp.begin(); iter != resp.end(); iter++) {
|
for (const auto &iter : resp) {
|
||||||
if (iter->contains(K0Seg2Phys(a0) & PAddrImplMask))
|
if (iter.contains(K0Seg2Phys(a0) & PAddrImplMask))
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,22 +50,9 @@
|
||||||
#ifndef __MEM_PORT_HH__
|
#ifndef __MEM_PORT_HH__
|
||||||
#define __MEM_PORT_HH__
|
#define __MEM_PORT_HH__
|
||||||
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
#include "base/addr_range.hh"
|
#include "base/addr_range.hh"
|
||||||
#include "mem/packet.hh"
|
#include "mem/packet.hh"
|
||||||
|
|
||||||
/**
|
|
||||||
* This typedef is used to clean up getAddrRanges(). It's declared
|
|
||||||
* outside the Port object since it's also used by some mem objects.
|
|
||||||
* Eventually we should move this typedef to wherever Addr is
|
|
||||||
* defined.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef std::list<AddrRange> AddrRangeList;
|
|
||||||
typedef std::list<AddrRange>::iterator AddrRangeIter;
|
|
||||||
typedef std::list<AddrRange>::const_iterator AddrRangeConstIter;
|
|
||||||
|
|
||||||
class MemObject;
|
class MemObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -526,8 +526,8 @@ RubyPort::PioSlavePort::getAddrRanges() const
|
||||||
ranges.splice(ranges.begin(),
|
ranges.splice(ranges.begin(),
|
||||||
ruby_port->master_ports[i]->getAddrRanges());
|
ruby_port->master_ports[i]->getAddrRanges());
|
||||||
}
|
}
|
||||||
for (AddrRangeConstIter r = ranges.begin(); r != ranges.end(); ++r)
|
for (const auto M5_VAR_USED &r : ranges)
|
||||||
DPRINTF(RubyPort, "%s\n", r->to_string());
|
DPRINTF(RubyPort, "%s\n", r.to_string());
|
||||||
return ranges;
|
return ranges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue