RangeAddrMapper::remapAddr(Addr addr) const
{
for (int i = 0; i < originalRanges.size(); ++i) {
- if (originalRanges[i] == addr) {
- Addr offset = addr - originalRanges[i].start;
- return offset + remappedRanges[i].start;
+ if (originalRanges[i].contains(addr)) {
+ Addr offset = addr - originalRanges[i].start();
+ return offset + remappedRanges[i].start();
}
}
AddrRangeList
RangeAddrMapper::getAddrRanges() const
{
- AddrRangeList ranges;
- AddrRangeList actualRanges = masterPort.getAddrRanges();
-
- for (AddrRangeIter r = actualRanges.begin(); r != actualRanges.end(); ++r) {
- AddrRange range = *r;
-
- for (int j = 0; j < originalRanges.size(); ++j) {
- if (range.intersects(originalRanges[j]))
- fatal("Cannot remap range that intersects the original"
- " ranges but are not a subset.\n");
- if (range.isSubset(originalRanges[j])) {
- // range is a subset
- Addr offset = range.start - originalRanges[j].start;
- range.start -= offset;
- range.end -= offset;
- }
- ranges.push_back(range);
- }
- }
-
+ // Simply return the original ranges as given by the parameters
+ AddrRangeList ranges(originalRanges.begin(), originalRanges.end());
return ranges;
}