2017-12-31 23:49:35 +00:00
|
|
|
//
|
|
|
|
// AddressMapper.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 30/12/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-12-31 23:49:35 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef AddressMapper_hpp
|
|
|
|
#define AddressMapper_hpp
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
2018-01-25 02:48:44 +00:00
|
|
|
namespace Analyser {
|
|
|
|
namespace Static {
|
2017-12-31 23:49:35 +00:00
|
|
|
namespace Disassembler {
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Provides an address mapper that relocates a chunk of memory so that it starts at
|
|
|
|
address @c start_address.
|
|
|
|
*/
|
|
|
|
template <typename T> std::function<std::size_t(T)> OffsetMapper(T start_address) {
|
|
|
|
return [start_address](T argument) {
|
2020-05-10 03:00:39 +00:00
|
|
|
return size_t(argument - start_address);
|
2017-12-31 23:49:35 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-01-25 02:48:44 +00:00
|
|
|
}
|
2017-12-31 23:49:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* AddressMapper_hpp */
|