X86ISA::Interrupts::getAddrRanges() const
{
AddrRangeList ranges;
- Range<Addr> range = RangeEx(x86LocalAPICAddress(initialApicId, 0),
- x86LocalAPICAddress(initialApicId, 0) +
- PageBytes);
+ AddrRange range = RangeEx(x86LocalAPICAddress(initialApicId, 0),
+ x86LocalAPICAddress(initialApicId, 0) +
+ PageBytes);
ranges.push_back(range);
return ranges;
}
--- /dev/null
+/*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Copyright (c) 2002-2005 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Nathan Binkert
+ * Steve Reinhardt
+ * Andreas Hansson
+ */
+
+#ifndef __BASE_ADDR_RANGE_HH__
+#define __BASE_ADDR_RANGE_HH__
+
+#include "base/types.hh"
+
+class AddrRange
+{
+
+ public:
+
+ Addr start;
+ Addr end;
+
+ AddrRange()
+ : start(1), end(0)
+ {}
+
+ AddrRange(Addr _start, Addr _end)
+ : start(_start), end(_end)
+ {}
+
+ AddrRange(const std::pair<Addr, Addr> &r)
+ : start(r.first), end(r.second)
+ {}
+
+ Addr size() const { return end - start + 1; }
+ bool valid() const { return start < end; }
+};
+
+/**
+ * Keep the operators away from SWIG.
+ */
+#ifndef SWIG
+
+/**
+ * @param range1 is a range.
+ * @param range2 is a range.
+ * @return if range1 is less than range2 and does not overlap range1.
+ */
+inline bool
+operator<(const AddrRange& range1, const AddrRange& range2)
+{
+ return range1.start < range2.start;
+}
+
+/**
+ * @param addr address in the range
+ * @param range range compared against.
+ * @return indicates that the address is not within the range.
+ */
+inline bool
+operator!=(const Addr& addr, const AddrRange& range)
+{
+ return addr < range.start || addr > range.end;
+}
+
+/**
+ * @param range range compared against.
+ * @param pos position compared to the range.
+ * @return indicates that position pos is within the range.
+ */
+inline bool
+operator==(const AddrRange& range, const Addr& addr)
+{
+ return addr >= range.start && addr <= range.end;
+}
+
+inline AddrRange
+RangeEx(Addr start, Addr end)
+{ return std::make_pair(start, end - 1); }
+
+inline AddrRange
+RangeIn(Addr start, Addr end)
+{ return std::make_pair(start, end); }
+
+inline AddrRange
+RangeSize(Addr start, Addr size)
+{ return std::make_pair(start, start + size - 1); }
+
+#endif // SWIG
+
+#endif // __BASE_ADDR_RANGE_HH__
--- /dev/null
+/*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Copyright (c) 2006 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Ali Saidi
+ * Andreas Hansson
+ */
+
+#ifndef __BASE_ADDR_RANGE_MAP_HH__
+#define __BASE_ADDR_RANGE_MAP_HH__
+
+#include <map>
+#include <utility>
+
+#include "base/addr_range.hh"
+
+/**
+ * The AddrRangeMap uses an STL map to implement an interval tree for
+ * address decoding. The value stored is a template type and can be
+ * e.g. a port identifier, or a pointer.
+ */
+template <typename V>
+class AddrRangeMap
+{
+ private:
+ typedef std::map<AddrRange, V> RangeMap;
+ RangeMap tree;
+
+ public:
+ typedef typename RangeMap::iterator iterator;
+ typedef typename RangeMap::const_iterator const_iterator;
+
+ const_iterator
+ find(const AddrRange &r) const
+ {
+ const_iterator i;
+
+ i = tree.upper_bound(r);
+
+ if (i == tree.begin()) {
+ if (i->first.start <= r.end && i->first.end >= r.start)
+ return i;
+ else
+ // Nothing could match, so return end()
+ return tree.end();
+ }
+
+ --i;
+
+ if (i->first.start <= r.end && i->first.end >= r.start)
+ return i;
+
+ return tree.end();
+ }
+
+ iterator
+ find(const AddrRange &r)
+ {
+ iterator i;
+
+ i = tree.upper_bound(r);
+
+ if (i == tree.begin()) {
+ if (i->first.start <= r.end && i->first.end >= r.start)
+ return i;
+ else
+ // Nothing could match, so return end()
+ return tree.end();
+ }
+
+ --i;
+
+ if (i->first.start <= r.end && i->first.end >= r.start)
+ return i;
+
+ return tree.end();
+ }
+
+ const_iterator
+ find(const Addr &r) const
+ {
+ return find(RangeSize(r, 1));
+ }
+
+ iterator
+ find(const Addr &r)
+ {
+ return find(RangeSize(r, 1));
+ }
+
+ bool
+ intersect(const AddrRange &r)
+ {
+ iterator i;
+ i = find(r);
+ if (i != tree.end())
+ return true;
+ return false;
+ }
+
+ iterator
+ insert(const AddrRange &r, const V& d)
+ {
+ if (intersect(r))
+ return tree.end();
+
+ return tree.insert(std::make_pair(r, d)).first;
+ }
+
+ std::size_t
+ erase(Addr k)
+ {
+ return tree.erase(k);
+ }
+
+ void
+ erase(iterator p)
+ {
+ tree.erase(p);
+ }
+
+ void
+ erase(iterator p, iterator q)
+ {
+ tree.erase(p,q);
+ }
+
+ void
+ clear()
+ {
+ tree.erase(tree.begin(), tree.end());
+ }
+
+ const_iterator
+ begin() const
+ {
+ return tree.begin();
+ }
+
+ iterator
+ begin()
+ {
+ return tree.begin();
+ }
+
+ const_iterator
+ end() const
+ {
+ return tree.end();
+ }
+
+ iterator
+ end()
+ {
+ return tree.end();
+ }
+
+ std::size_t
+ size() const
+ {
+ return tree.size();
+ }
+
+ bool
+ empty() const
+ {
+ return tree.empty();
+ }
+};
+
+#endif //__BASE_ADDR_RANGE_MAP_HH__
#include <utility>
#include <vector>
-#include "base/range.hh"
#include "base/types.hh"
#include "dev/etherpkt.hh"
#include "dnet/os.h"
#include <ios>
#include <string>
-#include "base/range.hh"
#include "base/types.hh"
class Checkpoint;
return _random(min, max);
}
- template <typename T>
- T
- random(const Range<T> &range)
- {
- return _random(range.start, range.end);
- }
-
// [0,1]
double
gen_real1()
+++ /dev/null
-/*
- * Copyright (c) 2002-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Nathan Binkert
- * Steve Reinhardt
- */
-
-#ifndef __BASE_RANGE_HH__
-#define __BASE_RANGE_HH__
-
-template <class T>
-struct Range
-{
- T start;
- T end;
-
- Range() { invalidate(); }
-
- template <class U>
- Range(const std::pair<U, U> &r)
- : start(r.first), end(r.second)
- {}
-
- template <class U>
- Range(const Range<U> &r)
- : start(r.start), end(r.end)
- {}
-
- template <class U>
- const Range<T> &operator=(const Range<U> &r)
- {
- start = r.start;
- end = r.end;
- return *this;
- }
-
- template <class U>
- const Range<T> &operator=(const std::pair<U, U> &r)
- {
- start = r.first;
- end = r.second;
- return *this;
- }
-
- void invalidate() { start = 1; end = 0; }
- T size() const { return end - start + 1; }
- bool valid() const { return start < end; }
-};
-
-template <class T>
-inline Range<T>
-RangeEx(T start, T end)
-{ return std::make_pair(start, end - 1); }
-
-template <class T>
-inline Range<T>
-RangeIn(T start, T end)
-{ return std::make_pair(start, end); }
-
-template <class T, class U>
-inline Range<T>
-RangeSize(T start, U size)
-{ return std::make_pair(start, start + size - 1); }
-
-////////////////////////////////////////////////////////////////////////
-//
-// Range to Range Comparisons
-//
-
-/**
- * @param range1 is a range.
- * @param range2 is a range.
- * @return if range1 and range2 are identical.
- */
-template <class T, class U>
-inline bool
-operator==(const Range<T> &range1, const Range<U> &range2)
-{
- return range1.start == range2.start && range1.end == range2.end;
-}
-
-/**
- * @param range1 is a range.
- * @param range2 is a range.
- * @return if range1 and range2 are not identical.
- */
-template <class T, class U>
-inline bool
-operator!=(const Range<T> &range1, const Range<U> &range2)
-{
- return range1.start != range2.start || range1.end != range2.end;
-}
-
-/**
- * @param range1 is a range.
- * @param range2 is a range.
- * @return if range1 is less than range2 and does not overlap range1.
- */
-template <class T, class U>
-inline bool
-operator<(const Range<T> &range1, const Range<U> &range2)
-{
- return range1.start < range2.start;
-}
-
-/**
- * @param range1 is a range.
- * @param range2 is a range.
- * @return if range1 is less than range2. range1 may overlap range2,
- * but not extend beyond the end of range2.
- */
-template <class T, class U>
-inline bool
-operator<=(const Range<T> &range1, const Range<U> &range2)
-{
- return range1.start <= range2.start;
-}
-
-/**
- * @param range1 is a range.
- * @param range2 is a range.
- * @return if range1 is greater than range2 and does not overlap range2.
- */
-template <class T, class U>
-inline bool
-operator>(const Range<T> &range1, const Range<U> &range2)
-{
- return range1.start > range2.start;
-}
-
-/**
- * @param range1 is a range.
- * @param range2 is a range.
- * @return if range1 is greater than range2. range1 may overlap range2,
- * but not extend beyond the beginning of range2.
- */
-template <class T, class U>
-inline bool
-operator>=(const Range<T> &range1, const Range<U> &range2)
-{
- return range1.start >= range2.start;
-}
-
-////////////////////////////////////////////////////////////////////////
-//
-// Position to Range Comparisons
-//
-
-/**
- * @param pos position compared to the range.
- * @param range range compared against.
- * @return indicates that position pos is within the range.
- */
-template <class T, class U>
-inline bool
-operator==(const T &pos, const Range<U> &range)
-{
- return pos >= range.start && pos <= range.end;
-}
-
-/**
- * @param pos position compared to the range.
- * @param range range compared against.
- * @return indicates that position pos is not within the range.
- */
-template <class T, class U>
-inline bool
-operator!=(const T &pos, const Range<U> &range)
-{
- return pos < range.start || pos > range.end;
-}
-
-/**
- * @param pos position compared to the range.
- * @param range range compared against.
- * @return indicates that position pos is below the range.
- */
-template <class T, class U>
-inline bool
-operator<(const T &pos, const Range<U> &range)
-{
- return pos < range.start;
-}
-
-/**
- * @param pos position compared to the range.
- * @param range range compared against.
- * @return indicates that position pos is below or in the range.
- */
-template <class T, class U>
-inline bool
-operator<=(const T &pos, const Range<U> &range)
-{
- return pos <= range.end;
-}
-
-/**
- * @param pos position compared to the range.
- * @param range range compared against.
- * @return indicates that position pos is above the range.
- */
-template <class T, class U>
-inline bool
-operator>(const T &pos, const Range<U> &range)
-{
- return pos > range.end;
-}
-
-/**
- * @param pos position compared to the range.
- * @param range range compared against.
- * @return indicates that position pos is above or in the range.
- */
-template <class T, class U>
-inline bool
-operator>=(const T &pos, const Range<U> &range)
-{
- return pos >= range.start;
-}
-
-////////////////////////////////////////////////////////////////////////
-//
-// Range to Position Comparisons (for symmetry)
-//
-
-/**
- * @param range range compared against.
- * @param pos position compared to the range.
- * @return indicates that position pos is within the range.
- */
-template <class T, class U>
-inline bool
-operator==(const Range<T> &range, const U &pos)
-{
- return pos >= range.start && pos <= range.end;
-}
-
-/**
- * @param range range compared against.
- * @param pos position compared to the range.
- * @return indicates that position pos is not within the range.
- */
-template <class T, class U>
-inline bool
-operator!=(const Range<T> &range, const U &pos)
-{
- return pos < range.start || pos > range.end;
-}
-
-/**
- * @param range range compared against.
- * @param pos position compared to the range.
- * @return indicates that position pos is above the range.
- */
-template <class T, class U>
-inline bool
-operator<(const Range<T> &range, const U &pos)
-{
- // with -std=gnu++0x, gcc and clang get confused when range.end is
- // compared to pos using the operator "<", and the parser expects it
- // to be the opening bracket for a template parameter,
- // i.e. range.end<pos>(...);, the reason seems to be the range-type
- // iteration introduced in c++11 where begin and end are members
- // that return iterators
- return operator<(range.end, pos);
-}
-
-/**
- * @param range range compared against.
- * @param pos position compared to the range.
- * @return indicates that position pos is above or in the range.
- */
-template <class T, class U>
-inline bool
-operator<=(const Range<T> &range, const U &pos)
-{
- return range.start <= pos;
-}
-
-/**
- * @param range range compared against.
- * @param pos position compared to the range.
- * 'range > pos' indicates that position pos is below the range.
- */
-template <class T, class U>
-inline bool
-operator>(const Range<T> &range, const U &pos)
-{
- return range.start > pos;
-}
-
-/**
- * @param range range compared against.
- * @param pos position compared to the range.
- * 'range >= pos' indicates that position pos is below or in the range.
- */
-template <class T, class U>
-inline bool
-operator>=(const Range<T> &range, const U &pos)
-{
- return range.end >= pos;
-}
-
-#endif // __BASE_RANGE_HH__
+++ /dev/null
-/*
- * Copyright (c) 2006 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Ali Saidi
- */
-
-#ifndef __BASE_RANGE_MAP_HH__
-#define __BASE_RANGE_MAP_HH__
-
-#include <map>
-#include <utility>
-
-#include "base/range.hh"
-
-/**
- * The range_map uses an STL map to implement an interval tree. The
- * type of both the key (range) and the value are template
- * parameters. It can, for example, be used for address decoding,
- * using a range of addresses to map to ports.
- */
-template <class T,class V>
-class range_map
-{
- private:
- typedef std::map<Range<T>,V> RangeMap;
- RangeMap tree;
-
- public:
- typedef typename RangeMap::iterator iterator;
- typedef typename RangeMap::const_iterator const_iterator;
-
- template <class U>
- const_iterator
- find(const Range<U> &r) const
- {
- const_iterator i;
-
- i = tree.upper_bound(r);
-
- if (i == tree.begin()) {
- if (i->first.start <= r.end && i->first.end >= r.start)
- return i;
- else
- // Nothing could match, so return end()
- return tree.end();
- }
-
- --i;
-
- if (i->first.start <= r.end && i->first.end >= r.start)
- return i;
-
- return tree.end();
- }
-
- template <class U>
- iterator
- find(const Range<U> &r)
- {
- iterator i;
-
- i = tree.upper_bound(r);
-
- if (i == tree.begin()) {
- if (i->first.start <= r.end && i->first.end >= r.start)
- return i;
- else
- // Nothing could match, so return end()
- return tree.end();
- }
-
- --i;
-
- if (i->first.start <= r.end && i->first.end >= r.start)
- return i;
-
- return tree.end();
- }
-
- template <class U>
- const_iterator
- find(const U &r) const
- {
- return find(RangeSize(r, 1));
- }
-
- template <class U>
- iterator
- find(const U &r)
- {
- return find(RangeSize(r, 1));
- }
-
- template <class U>
- bool
- intersect(const Range<U> &r)
- {
- iterator i;
- i = find(r);
- if (i != tree.end())
- return true;
- return false;
- }
-
- template <class U,class W>
- iterator
- insert(const Range<U> &r, const W d)
- {
- if (intersect(r))
- return tree.end();
-
- return tree.insert(std::make_pair(r, d)).first;
- }
-
- size_t
- erase(T k)
- {
- return tree.erase(k);
- }
-
- void
- erase(iterator p)
- {
- tree.erase(p);
- }
-
- void
- erase(iterator p, iterator q)
- {
- tree.erase(p,q);
- }
-
- void
- clear()
- {
- tree.erase(tree.begin(), tree.end());
- }
-
- const_iterator
- begin() const
- {
- return tree.begin();
- }
-
- iterator
- begin()
- {
- return tree.begin();
- }
-
- const_iterator
- end() const
- {
- return tree.end();
- }
-
- iterator
- end()
- {
- return tree.end();
- }
-
- size_t
- size() const
- {
- return tree.size();
- }
-
- bool
- empty() const
- {
- return tree.empty();
- }
-};
-
-#endif //__BASE_RANGE_MAP_HH__
#include "base/inifile.hh"
#include "base/misc.hh"
#include "base/pollevent.hh"
-#include "base/range.hh"
#include "base/trace.hh"
#include "base/types.hh"
#include "config/the_isa.hh"
#ifndef __DEV_ALPHA_BACKDOOR_HH__
#define __DEV_ALPHA_BACKDOOR_HH__
-#include "base/range.hh"
#include "base/types.hh"
#include "dev/alpha/access.h"
#include "dev/io_device.hh"
#ifndef __TSUNAMI_CCHIP_HH__
#define __TSUNAMI_CCHIP_HH__
-#include "base/range.hh"
#include "dev/alpha/tsunami.hh"
#include "dev/io_device.hh"
#include "params/TsunamiCChip.hh"
#ifndef __DEV_TSUNAMI_IO_HH__
#define __DEV_TSUNAMI_IO_HH__
-#include "base/range.hh"
#include "dev/alpha/tsunami.hh"
#include "dev/intel_8254_timer.hh"
#include "dev/io_device.hh"
#ifndef __TSUNAMI_PCHIP_HH__
#define __TSUNAMI_PCHIP_HH__
-#include "base/range.hh"
#include "dev/alpha/tsunami.hh"
#include "dev/io_device.hh"
#include "params/TsunamiPChip.hh"
#ifndef __DEV_ARM_A9SCU_HH__
#define __DEV_ARM_A9SCU_HH__
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "params/A9SCU.hh"
#ifndef __DEV_ARM_AMBA_DEVICE_HH__
#define __DEV_ARM_AMBA_DEVICE_HH__
-#include "base/range.hh"
#include "dev/arm/gic.hh"
#include "dev/dma_device.hh"
#include "dev/io_device.hh"
#ifndef __DEV_ARM_AMBA_FAKE_H__
#define __DEV_ARM_AMBA_FAKE_H__
-#include "base/range.hh"
#include "dev/arm/amba_device.hh"
#include "params/AmbaFake.hh"
#define __DEV_ARM_GIC_H__
#include "base/bitunion.hh"
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "dev/platform.hh"
#include "cpu/intr_control.hh"
#include <list>
#include "base/vnc/vncserver.hh"
-#include "base/range.hh"
#include "dev/arm/amba_device.hh"
#include "params/Pl050.hh"
#ifndef __DEV_ARM_PL011_H__
#define __DEV_ARM_PL011_H__
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "dev/uart.hh"
#include "params/Pl011.hh"
#include <fstream>
-#include "base/range.hh"
#include "dev/arm/amba_device.hh"
#include "params/Pl111.hh"
#include "sim/serialize.hh"
#ifndef __DEV_ARM_RTC_PL310_HH__
#define __DEV_ARM_RTC_PL310_HH__
-#include "base/range.hh"
#include "dev/arm/amba_device.hh"
#include "params/PL031.hh"
#define __DEV_ARM_RV_HH__
#include "base/bitunion.hh"
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "params/RealViewCtrl.hh"
#ifndef __DEV_ARM_LOCALTIMER_HH__
#define __DEV_ARM_LOCALTIMER_HH__
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "params/CpuLocalTimer.hh"
#ifndef __DEV_ARM_SP804_HH__
#define __DEV_ARM_SP804_HH__
-#include "base/range.hh"
#include "dev/arm/amba_device.hh"
#include "params/Sp804.hh"
#ifndef __DEV_BADDEV_HH__
#define __DEV_BADDEV_HH__
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "params/BadDevice.hh"
#include <string>
-#include "base/range.hh"
#include "dev/io_device.hh"
// #include "dev/alpha/tsunami.hh"
#include "mem/packet.hh"
#ifndef __DEV_MC146818_HH__
#define __DEV_MC146818_HH__
-#include "base/range.hh"
#include "sim/eventq.hh"
/** Real-Time Clock (MC146818) */
#ifndef __MALTA_CCHIP_HH__
#define __MALTA_CCHIP_HH__
-#include "base/range.hh"
#include "dev/mips/malta.hh"
#include "dev/io_device.hh"
#include "params/MaltaCChip.hh"
#ifndef __DEV_MALTA_IO_HH__
#define __DEV_MALTA_IO_HH__
-#include "base/range.hh"
#include "dev/mips/malta.hh"
#include "dev/intel_8254_timer.hh"
#include "dev/io_device.hh"
#ifndef __MALTA_PCHIP_HH__
#define __MALTA_PCHIP_HH__
-#include "base/range.hh"
#include "dev/mips/malta.hh"
#include "dev/io_device.hh"
#include "params/MaltaPChip.hh"
#ifndef __PCICONFIGALL_HH__
#define __PCICONFIGALL_HH__
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "dev/pcireg.h"
#include "params/PciConfigAll.hh"
#include <vector>
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "params/DumbTOD.hh"
#ifndef __DEV_SPARC_IOB_HH__
#define __DEV_SPARC_IOB_HH__
-#include "base/range.hh"
#include "dev/disk_image.hh"
#include "dev/io_device.hh"
#include "params/Iob.hh"
#ifndef __DEV_SPARC_MM_DISK_HH__
#define __DEV_SPARC_MM_DISK_HH__
-#include "base/range.hh"
#include "dev/disk_image.hh"
#include "dev/io_device.hh"
#include "params/MmDisk.hh"
#ifndef __UART_HH__
#define __UART_HH__
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "params/Uart.hh"
#ifndef __DEV_UART8250_HH__
#define __DEV_UART8250_HH__
-#include "base/range.hh"
#include "dev/io_device.hh"
#include "dev/uart.hh"
#include "params/Uart8250.hh"
#include <map>
#include "base/bitunion.hh"
-#include "base/range_map.hh"
#include "dev/x86/intdev.hh"
#include "dev/io_device.hh"
#include "params/I82094AA.hh"
int fd = open(params()->file.c_str(), O_RDONLY);
long _size = lseek(fd, 0, SEEK_END);
if (_size != range.size()) {
- warn("Specified size %d does not match file %s %d\n", range.size(),
- params()->file, _size);
- range = RangeSize(range.start, _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)),
bwTotal = (bytesRead + bytesWritten) / simSeconds;
}
-Range<Addr>
+AddrRange
AbstractMemory::getAddrRange() const
{
return range;
protected:
// Address range of this memory
- Range<Addr> range;
+ AddrRange range;
// Pointer to host memory used to implement this memory
uint8_t* pmemAddr;
*
* @return a single contigous address range
*/
- Range<Addr> getAddrRange() const;
+ AddrRange getAddrRange() const;
/**
* Get the memory size.
Bridge& _bridge,
BridgeMasterPort& _masterPort,
Cycles _delay, int _resp_limit,
- std::vector<Range<Addr> > _ranges)
+ std::vector<AddrRange> _ranges)
: SlavePort(_name, &_bridge), bridge(_bridge), masterPort(_masterPort),
delay(_delay), ranges(_ranges.begin(), _ranges.end()),
outstandingResponses(0), retryReq(false),
*/
BridgeSlavePort(const std::string& _name, Bridge& _bridge,
BridgeMasterPort& _masterPort, Cycles _delay,
- int _resp_limit, std::vector<Range<Addr> > _ranges);
+ int _resp_limit, std::vector<AddrRange> _ranges);
/**
* Queue a response packet to be sent out later and also schedule
void
BaseBus::recvRangeChange(PortID master_port_id)
{
- AddrRangeList ranges;
AddrRangeIter iter;
if (inRecvRangeChange.count(master_port_id))
}
// get the address ranges of the connected slave port
- ranges = port->getAddrRanges();
+ AddrRangeList ranges = port->getAddrRanges();
for (iter = ranges.begin(); iter != ranges.end(); iter++) {
DPRINTF(BusAddrRanges, "Adding range %#llx - %#llx for id %d\n",
#include <list>
#include <set>
-#include "base/range.hh"
-#include "base/range_map.hh"
+#include "base/addr_range_map.hh"
#include "base/types.hh"
#include "mem/mem_object.hh"
#include "params/BaseBus.hh"
/** the width of the bus in bytes */
int width;
- typedef range_map<Addr, PortID>::iterator PortMapIter;
- typedef range_map<Addr, PortID>::const_iterator PortMapConstIter;
- range_map<Addr, PortID> portMap;
+ typedef AddrRangeMap<PortID>::iterator PortMapIter;
+ typedef AddrRangeMap<PortID>::const_iterator PortMapConstIter;
+ AddrRangeMap<PortID> portMap;
AddrRangeList defaultRange;
*/
#include "base/misc.hh"
-#include "base/range.hh"
#include "base/types.hh"
#include "debug/Cache.hh"
#include "debug/CachePort.hh"
"Skipping memory %s that is not in global address map\n",
(*m)->name());
}
- rangeCache.invalidate();
}
bool
// see if the address is within the last matched range
if (addr != rangeCache) {
// lookup in the interval tree
- range_map<Addr, AbstractMemory*>::const_iterator r =
- addrMap.find(addr);
+ AddrRangeMap<AbstractMemory*>::const_iterator r = addrMap.find(addr);
if (r == addrMap.end()) {
// not in the cache, and not in the tree
return false;
{
assert(pkt->isRequest());
Addr addr = pkt->getAddr();
- range_map<Addr, AbstractMemory*>::const_iterator m = addrMap.find(addr);
+ AddrRangeMap<AbstractMemory*>::const_iterator m = addrMap.find(addr);
assert(m != addrMap.end());
m->second->access(pkt);
}
{
assert(pkt->isRequest());
Addr addr = pkt->getAddr();
- range_map<Addr, AbstractMemory*>::const_iterator m = addrMap.find(addr);
+ AddrRangeMap<AbstractMemory*>::const_iterator m = addrMap.find(addr);
assert(m != addrMap.end());
m->second->functionalAccess(pkt);
}
#ifndef __PHYSICAL_MEMORY_HH__
#define __PHYSICAL_MEMORY_HH__
-#include "base/range_map.hh"
+#include "base/addr_range_map.hh"
#include "mem/abstract_mem.hh"
#include "mem/packet.hh"
private:
// Global address map
- range_map<Addr, AbstractMemory* > addrMap;
+ AddrRangeMap<AbstractMemory*> addrMap;
// a mutable cache for the last range that matched an address
- mutable Range<Addr> rangeCache;
+ mutable AddrRange rangeCache;
// All address-mapped memories
std::vector<AbstractMemory*> memories;
#include <list>
-#include "base/range.hh"
+#include "base/addr_range.hh"
#include "mem/packet.hh"
/**
* defined.
*/
-typedef std::list<Range<Addr> > AddrRangeList;
-typedef std::list<Range<Addr> >::iterator AddrRangeIter;
-typedef std::list<Range<Addr> >::const_iterator AddrRangeConstIter;
+typedef std::list<AddrRange> AddrRangeList;
+typedef std::list<AddrRange>::iterator AddrRangeIter;
+typedef std::list<AddrRange>::const_iterator AddrRangeConstIter;
class MemObject;
return self.value + other
class AddrRange(ParamValue):
- cxx_type = 'Range<Addr>'
+ cxx_type = 'AddrRange'
def __init__(self, *args, **kwargs):
def handle_kwargs(self, kwargs):
@classmethod
def cxx_predecls(cls, code):
Addr.cxx_predecls(code)
- code('#include "base/range.hh"')
+ code('#include "base/addr_range.hh"')
@classmethod
def swig_predecls(cls, code):
Addr.swig_predecls(code)
- code('%import "python/swig/range.i"')
def getValue(self):
+ # Go from the Python class to the wrapped C++ class generated
+ # by swig
from m5.internal.range import AddrRange
- value = AddrRange()
- value.start = long(self.start)
- value.end = long(self.end)
- return value
+ return AddrRange(long(self.start), long(self.end))
# Boolean parameter type. Python doesn't let you subclass bool, since
# it doesn't want to let you create multiple instances of True and
%module(package="m5.internal") range
%{
-#include "base/range.hh"
#include "base/types.hh"
+#include "base/addr_range.hh"
%}
%include <stdint.i>
%rename(assign) *::operator=;
-%include "base/range.hh"
%include "base/types.hh"
-
-%template(AddrRange) Range<Addr>;
-%template(TickRange) Range<Tick>;
+%include "base/addr_range.hh"
/*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
* Copyright (c) 2006 The Regents of The University of Michigan
* All rights reserved.
*
#include <cassert>
#include <iostream>
-#include "base/range_map.hh"
-#include "base/types.hh"
+#include "base/addr_range_map.hh"
using namespace std;
int
main()
{
- range_map<Addr,int> r;
+ AddrRangeMap<int> r;
- range_map<Addr,int>::iterator i;
+ AddrRangeMap<int>::iterator i;
- i = r.insert(RangeIn<Addr>(10,40),5);
+ i = r.insert(RangeIn(10, 40), 5);
assert(i != r.end());
- i = r.insert(RangeIn<Addr>(60,90),3);
+ i = r.insert(RangeIn(60, 90), 3);
assert(i != r.end());
- i = r.find(RangeIn(20,30));
+ i = r.find(RangeIn(20, 30));
assert(i != r.end());
cout << i->first << " " << i->second << endl;
- i = r.find(RangeIn(55,55));
+ i = r.find(RangeIn(55, 55));
assert(i == r.end());
- i = r.insert(RangeIn<Addr>(0,12),1);
+ i = r.insert(RangeIn(0, 12), 1);
assert(i == r.end());
- i = r.insert(RangeIn<Addr>(0,9),1);
+ i = r.insert(RangeIn(0, 9), 1);
assert(i != r.end());
- i = r.find(RangeIn(20,30));
+ i = r.find(RangeIn(20, 30));
assert(i != r.end());
cout << i->first << " " << i->second << endl;
+ return 0;
}
-
-
-
-
-
-
-
-