2017-12-31 18:49:35 -05:00
|
|
|
//
|
|
|
|
// AddressMapper.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 30/12/2017.
|
2018-05-13 15:19:52 -04:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-12-31 18:49:35 -05:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef AddressMapper_hpp
|
|
|
|
#define AddressMapper_hpp
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
2018-01-24 21:48:44 -05:00
|
|
|
namespace Analyser {
|
|
|
|
namespace Static {
|
2017-12-31 18:49:35 -05: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-09 23:00:39 -04:00
|
|
|
return size_t(argument - start_address);
|
2017-12-31 18:49:35 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-01-24 21:48:44 -05:00
|
|
|
}
|
2017-12-31 18:49:35 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* AddressMapper_hpp */
|