"failstar" sounds like a name for a cruise liner from the 80s. As "*" isn't a desirable part of directory names, just name the whole thing "fail/", the core parts being stored in "fail/core/". Additionally fixing two build system dependency issues: - missing jobserver -> protomessages dependency - broken bochs -> fail dependency (add_custom_target DEPENDS only allows plain file dependencies ... cmake for the win) git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@956 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#ifndef __MEMORYMAP_HPP__
|
|
#define __MEMORYMAP_HPP__
|
|
|
|
#ifdef BOOST_1_46_OR_NEWER
|
|
#include <boost/icl/interval_set.hpp>
|
|
using namespace boost::icl;
|
|
#endif
|
|
|
|
#include <set>
|
|
#include "SAL/SALConfig.hpp"
|
|
|
|
/**
|
|
* \class MemoryMap
|
|
* An efficient container for memory maps with holes.
|
|
*/
|
|
class MemoryMap
|
|
{
|
|
#ifdef BOOST_1_46_OR_NEWER
|
|
typedef interval<sal::address_t>::type address_interval;
|
|
typedef interval_set<sal::address_t>::type address_set;
|
|
|
|
address_set as;
|
|
public:
|
|
MemoryMap() {}
|
|
void clear() { as.clear(); }
|
|
void add(sal::address_t addr, int size) { as.add(address_interval(addr, addr+size-1)); }
|
|
void isMatching(sal::address_t addr, int size) { return intersects(as, address_interval(addr, addr+size-1)); }
|
|
#endif
|
|
std::set<sal::address_t> as;
|
|
public:
|
|
MemoryMap() {}
|
|
void clear() { as.clear(); }
|
|
void add(sal::address_t addr, int size = 1)
|
|
{
|
|
for (int i = 0; i < size; ++i) {
|
|
as.insert(addr + i);
|
|
}
|
|
}
|
|
bool isMatching(sal::address_t addr, int size = 1)
|
|
{
|
|
for (int i = 0; i < size; ++i) {
|
|
if (as.find(addr + i) != as.end()) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
|
|
#endif
|