ROSE 0.11.145.141
Rose/BinaryAnalysis/Architecture/BasicTypes.h
1#ifndef ROSE_BinaryAnalysis_Architecture_BasicTypes_H
2#define ROSE_BinaryAnalysis_Architecture_BasicTypes_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/Architecture/Exception.h> // needed for Result<T,NotFound>
7#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
8
11
12#include <Sawyer/Message.h>
13#include <Sawyer/Result.h>
14#include <boost/filesystem.hpp>
15#include <memory>
16#include <set>
17#include <string>
18#include <vector>
19
20// Basic types needed by almost all architectures
21
22namespace Rose {
23namespace BinaryAnalysis {
24namespace Architecture {
25
27// Forward class declarations for built-in architectures and their reference-counting pointers.
29
30class Amd64;
31using Amd64Ptr = std::shared_ptr<Amd64>;
33class ArmAarch32;
34using ArmAarch32Ptr = std::shared_ptr<ArmAarch32>;
36class ArmAarch64;
37using ArmAarch64Ptr = std::shared_ptr<ArmAarch64>;
39class Base;
40using BasePtr = std::shared_ptr<Base>;
41using BaseConstPtr = std::shared_ptr<const Base>;
43class Cil;
44using CilPtr = std::shared_ptr<Cil>;
46class Intel80286;
47using Intel80286Ptr = std::shared_ptr<Intel80286>;
49class Intel8086;
50using Intel8086Ptr = std::shared_ptr<Intel8086>;
52class Intel8088;
53using Intel8088Ptr = std::shared_ptr<Intel8088>;
55class IntelI386;
56using IntelI386Ptr = std::shared_ptr<IntelI386>;
58class IntelI486;
59using IntelI486Ptr = std::shared_ptr<IntelI486>;
61class IntelPentium;
62using IntelPentiumPtr = std::shared_ptr<IntelPentium>;
64class IntelPentiumii;
65using IntelPentiumiiPtr = std::shared_ptr<IntelPentiumii>;
67class IntelPentiumiii;
68using IntelPentiumiiiPtr = std::shared_ptr<IntelPentiumiii>;
70class IntelPentium4;
71using IntelPentium4Ptr = std::shared_ptr<IntelPentium4>;
73class Jvm;
74using JvmPtr = std::shared_ptr<Jvm>;
76class Mips32;
77using Mips32Ptr = std::shared_ptr<Mips32>;
79class Motorola;
80using MotorolaPtr = std::shared_ptr<Motorola>;
82class Motorola68040;
83using Motorola68040Ptr = std::shared_ptr<Motorola68040>;
85class NxpColdfire;
86using NxpColdfirePtr = std::shared_ptr<NxpColdfire>;
88class Powerpc;
89using PowerpcPtr = std::shared_ptr<Powerpc>;
91class Powerpc32;
92using Powerpc32Ptr = std::shared_ptr<Powerpc32>;
94class Powerpc64;
95using Powerpc64Ptr = std::shared_ptr<Powerpc64>;
97class X86;
98using X86Ptr = std::shared_ptr<X86>;
101// Diagnostics
103
106
111
113// Subclass registration functions
115
127
138void registerDefinition(const std::string&);
139
143template<class Iterator>
144void registerDefinitions(Iterator begin, Iterator end) {
145 for (/*void*/; begin != end; ++begin)
146 registerDefinition(*begin);
147}
148
158
164std::vector<BasePtr> registeredDefinitions();
165
172std::set<std::string> registeredNames();
173
175// Searching for suitable architectures
177
187
197
206
215
224
226// Helper functions
228
239const std::string& name(const BaseConstPtr&);
240const std::string& name(size_t registrationId);
249
250} // namespace
251} // namespace
252} // namespace
253
254#endif
255#endif
Base class for architecture definitions.
Architecture-specific information for the Common Intermediate Language.
Architecture specific information for Intel 80286.
Definition Intel80286.h:21
Architecture-specific information for Intel 8086.
Definition Intel8086.h:19
Architecture-specific information for Intel 8088.
Definition Intel8088.h:18
Architecture-specific information for Intel i386.
Definition IntelI386.h:23
Architecture-specific information for Intel i486.
Definition IntelI486.h:29
Architecture-specific information for Intel Pentium4.
Architecture-specific information for Intel Pentium.
Architecture-specific information for Intel Pentium II.
Architecture-specific information for Intel Pentium III.
Architecture-specific information for the Java virtual machine.
Architecture-specific information for MIPS with 32-bit word size.
Definition Mips32.h:25
Architecture-specific information for Motorola 68040'.
Base class for Motorola processors.
Definition Motorola.h:12
Architecture-specific information for NXP ColdFire'.
Definition NxpColdfire.h:16
Architecture-specific information for PowerPC with 32-bit word size.
Definition Powerpc32.h:28
Architecture-specific information for PowerPC with 64-bit word size.
Definition Powerpc64.h:28
Base class for PowerPC architectures.
Common base class for all x86 architectures.
Collection of streams.
Definition Message.h:1606
Result containing a value or an error.
Definition Result.h:315
Base class for container file headers.
Represents an interpretation of a binary container.
std::shared_ptr< Base > BasePtr
Reference counted pointer for Architecture::Base.
std::shared_ptr< ArmAarch32 > ArmAarch32Ptr
Reference counted pointer for ArmAarch32.
Sawyer::Result< BasePtr, NotFound > findByInterpretation(SgAsmInterpretation *)
Finds a suitable architecture for a binary interpretation.
std::pair< BasePtr, size_t > findBestByInterpretation(SgAsmInterpretation *)
Finds the architecture that matches the most file headers.
std::set< std::string > registeredNames()
Names of all registered architectures.
Sawyer::Message::Facility mlog
Diagnostic facility for architecture definitions.
InstructionSemantics::BaseSemantics::DispatcherPtr newInstructionDispatcher(const std::string &name, const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &)
Create a new instruction dispatcher by name.
std::shared_ptr< IntelPentiumiii > IntelPentiumiiiPtr
Reference counted pointer for IntelPentiumiii.
std::shared_ptr< X86 > X86Ptr
Reference counted pointer for X86.
std::shared_ptr< Motorola68040 > Motorola68040Ptr
Reference counted pointer for Motorola68040.
std::shared_ptr< ArmAarch64 > ArmAarch64Ptr
Reference counted pointer for ArmAarch64.
std::shared_ptr< Amd64 > Amd64Ptr
Reference counted pointer for Amd64.
std::shared_ptr< Powerpc > PowerpcPtr
Reference counted pointer for Powerpc.
std::vector< BasePtr > registeredDefinitions()
Registered architectures.
size_t registerDefinition(const BasePtr &)
Register a new architecture definition.
void registerDefinitions(Iterator begin, Iterator end)
Register definitions from shared libraries.
std::shared_ptr< Intel8088 > Intel8088Ptr
Reference counted pointer for Intel8088.
std::shared_ptr< IntelPentium > IntelPentiumPtr
Reference counted pointer for IntelPentium.
std::shared_ptr< Intel80286 > Intel80286Ptr
Reference counted pointer for Intel80286.
std::shared_ptr< Mips32 > Mips32Ptr
Reference counted pointer for Mips32.
std::shared_ptr< NxpColdfire > NxpColdfirePtr
Reference counted pointer for NxpColdfire.
std::shared_ptr< const Base > BaseConstPtr
Reference counted pointer for Architecture::Base.
Sawyer::Result< BasePtr, NotFound > findByHeader(SgAsmGenericHeader *)
Finds a suitable architecture for a file header.
std::shared_ptr< Cil > CilPtr
Reference counted pointer for Cil.
std::shared_ptr< IntelPentium4 > IntelPentium4Ptr
Reference counted pointer for IntelPentium4.
bool deregisterDefinition(const BasePtr &)
Remove the specified architecture from the list of registered architectures.
Sawyer::Result< BasePtr, NotFound > findByName(const std::string &)
Look up a new architecture by name.
std::shared_ptr< IntelI386 > IntelI386Ptr
Reference counted pointer for IntelI386.
Sawyer::Result< BasePtr, NotFound > findById(size_t)
Look up a new architecture by registration ID.
void initDiagnostics()
Initialize and registers architecture diagnostic streams.
std::shared_ptr< IntelI486 > IntelI486Ptr
Reference counted pointer for IntelI486.
std::shared_ptr< Powerpc32 > Powerpc32Ptr
Reference counted pointer for Powerpc32.
std::shared_ptr< Jvm > JvmPtr
Reference counted pointer for Jvm.
std::shared_ptr< Powerpc64 > Powerpc64Ptr
Reference counted pointer for Powerpc64.
std::shared_ptr< Intel8086 > Intel8086Ptr
Reference counted pointer for Intel8086.
std::shared_ptr< Motorola > MotorolaPtr
Reference counted pointer for Motorola.
std::shared_ptr< IntelPentiumii > IntelPentiumiiPtr
Reference counted pointer for IntelPentiumii.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
The ROSE library.
const char * Architecture(int64_t)
Convert Rose::BinaryAnalysis::Disassembler::Mips::Decoder::Architecture enum constant to a string.