ROSE 0.11.145.147
Architecture/X86.h
1#ifndef ROSE_BinaryAnalysis_Architecture_X86_H
2#define ROSE_BinaryAnalysis_Architecture_X86_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/Architecture/Base.h>
6
7namespace Rose {
8namespace BinaryAnalysis {
9namespace Architecture {
10
12class X86: public Base {
13public:
14 using Ptr = X86Ptr;
15
16protected:
17 X86(const std::string &name, size_t bytesPerWord);
18public:
19 ~X86();
20
21public:
22 virtual const CallingConvention::Dictionary& callingConventions() const override;
23
26 std::string instructionMnemonic(const SgAsmInstruction*) const override;
28 bool isUnknown(const SgAsmInstruction*) const override;
29 bool isFunctionCallFast(const std::vector<SgAsmInstruction*>&, rose_addr_t *target, rose_addr_t *ret) const override;
30 bool isFunctionCallSlow(const std::vector<SgAsmInstruction*>&, rose_addr_t *target, rose_addr_t *ret) const override;
31 bool isFunctionReturnFast(const std::vector<SgAsmInstruction*>&) const override;
33 AddressSet getSuccessors(SgAsmInstruction*, bool &complete) const override;
34 AddressSet getSuccessors(const std::vector<SgAsmInstruction*> &basicBlock, bool &complete,
35 const MemoryMapPtr &initial_memory = MemoryMapPtr()) const override;
36
39
42
43 virtual std::vector<Partitioner2::FunctionPrologueMatcherPtr>
45
46 virtual std::vector<Partitioner2::BasicBlockCallbackPtr>
48
50 // Supporting functions
52protected:
53 // Create a new calling convention definition. The bitsPerWord is passed because, e.g., a 64-bit architecture can use a 32-bit
54 // calling convention since x86 architectures are generally backward compatible.
56 CallingConvention::Definition::Ptr cc_stdcall(size_t bitsPerWord) const;
57 CallingConvention::Definition::Ptr cc_fastcall(size_t bitsPerWord) const;
58};
59
60} // namespace
61} // namespace
62} // namespace
63
64#endif
65#endif
Information about alignments.
Definition Alignment.h:16
Base class for architecture definitions.
size_t bitsPerWord() const
Property: Word size.
size_t bytesPerWord() const
Property: Word size.
const std::string & name() const
Property: Architecture definition name.
Common base class for all x86 architectures.
std::string instructionMnemonic(const SgAsmInstruction *) const override
Mnemonic for an instruction.
bool isUnknown(const SgAsmInstruction *) const override
Returns true if the instruction is the special "unknown" instruction.
Alignment instructionAlignment() const override
Alignment for encoded machine instructions.
AddressSet getSuccessors(SgAsmInstruction *, bool &complete) const override
Control flow successors for a single instruction.
Sawyer::Optional< rose_addr_t > branchTarget(SgAsmInstruction *) const override
Obtains the virtual address for a branching instruction.
virtual std::vector< Partitioner2::FunctionPrologueMatcherPtr > functionPrologueMatchers(const Partitioner2::EnginePtr &) const override
Instruction patterns matching function prologues.
AddressSet getSuccessors(const std::vector< SgAsmInstruction * > &basicBlock, bool &complete, const MemoryMapPtr &initial_memory=MemoryMapPtr()) const override
Control flow successors for a basic block.
virtual InstructionSemantics::BaseSemantics::DispatcherPtr newInstructionDispatcher(const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &) const override
Construct and return a new instruction dispatcher.
Disassembler::BasePtr newInstructionDecoder() const override
Construct and return a new instruction decoder.
Sawyer::Container::Interval< size_t > bytesPerInstruction() const override
Valid sizes for encoded machine instructions.
virtual std::vector< Partitioner2::BasicBlockCallbackPtr > basicBlockCreationHooks(const Partitioner2::EnginePtr &) const override
Architecture-specific basic block callbacks for partitioning.
bool isFunctionReturnFast(const std::vector< SgAsmInstruction * > &) const override
Returns true if the specified basic block looks like a function return.
bool terminatesBasicBlock(SgAsmInstruction *) const override
Determines whether the specified instruction normally terminates a basic block.
Unparser::BasePtr newUnparser() const override
Construct and return a new instruction unparser.
bool isFunctionCallFast(const std::vector< SgAsmInstruction * > &, rose_addr_t *target, rose_addr_t *ret) const override
Returns true if the specified basic block looks like a function call.
virtual const CallingConvention::Dictionary & callingConventions() const override
Property: Calling convention definitions.
bool isFunctionCallSlow(const std::vector< SgAsmInstruction * > &, rose_addr_t *target, rose_addr_t *ret) const override
Returns true if the specified basic block looks like a function call.
Range of values delimited by endpoints.
Definition Interval.h:31
Holds a value or nothing.
Definition Optional.h:56
Base class for machine instructions.
std::shared_ptr< X86 > X86Ptr
Reference counted pointer for X86.
std::vector< DefinitionPtr > Dictionary
An ordered collection of calling convention definitions.
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.
Sawyer::SharedPointer< MemoryMap > MemoryMapPtr
Reference counting pointer.
The ROSE library.
const char * Architecture(int64_t)
Convert Rose::BinaryAnalysis::Disassembler::Mips::Decoder::Architecture enum constant to a string.