1 #ifndef ROSE_BinaryAnalysis_Partitioner2_ModulesX86_H
2 #define ROSE_BinaryAnalysis_Partitioner2_ModulesX86_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/BinaryAnalysis/Partitioner2/Modules.h>
7 #include <Rose/BinaryAnalysis/Partitioner2/Thunk.h>
10 namespace BinaryAnalysis {
11 namespace Partitioner2 {
14 namespace ModulesX86 {
32 virtual std::vector<Function::Ptr>
functions()
const override {
return std::vector<Function::Ptr>(1, function_); }
33 virtual bool match(
const Partitioner &partitioner, rose_addr_t anchor)
override;
47 virtual std::vector<Function::Ptr>
functions()
const override {
return std::vector<Function::Ptr>(1, function_); }
48 virtual bool match(
const Partitioner &partitioner, rose_addr_t anchor)
override;
57 virtual std::vector<Function::Ptr>
functions()
const override {
return std::vector<Function::Ptr>(1, function_); }
58 virtual bool match(
const Partitioner &partitioner, rose_addr_t anchor)
override;
67 virtual std::vector<Function::Ptr>
functions()
const override {
return std::vector<Function::Ptr>(1, function_); }
68 virtual bool match(
const Partitioner &partitioner, rose_addr_t anchor)
override;
77 virtual std::vector<Function::Ptr>
functions()
const override {
return std::vector<Function::Ptr>(1, function_); }
78 virtual bool match(
const Partitioner &partitioner, rose_addr_t anchor)
override;
90 virtual bool operator()(
bool chain,
const Args&)
override;
99 enum EntryType { ABSOLUTE, RELATIVE };
103 EntryType entryType_;
104 size_t entrySizeBytes_;
108 : entryType_(ABSOLUTE), entrySizeBytes_(4) {}
110 virtual bool operator()(
bool chain,
const Args&)
override;
161 SwitchSuccessors::EntryType tableEntryType,
size_t tableEntrySizeBytes,
163 size_t nSkippable = 0);
virtual bool match(const Partitioner &partitioner, rose_addr_t anchor) override
Attempt to match an instruction pattern.
Match RET followed by PUSH with intervening no-op padding.
Basic block callback to detect "switch" statements.
virtual bool match(const Partitioner &partitioner, rose_addr_t anchor) override
Attempt to match an instruction pattern.
static Ptr instance()
Allocating constructor.
Base class for adjusting basic blocks during discovery.
Base class for matching function prologues.
virtual std::vector< Function::Ptr > functions() const override
Returns the function(s) for the previous successful match.
Base class for machine instructions.
virtual std::vector< Function::Ptr > functions() const override
Returns the function(s) for the previous successful match.
Sawyer::Optional< rose_addr_t > findTableBase(SgAsmExpression *)
Try to match a base+offset expression.
bool matchMovDiDi(const Partitioner &, SgAsmX86Instruction *)
Matches "MOV EDI, EDI" or variant.
virtual std::vector< Function::Ptr > functions() const override
Returns the function(s) for the previous successful match.
virtual bool match(const Partitioner &partitioner, rose_addr_t anchor) override
Attempt to match an instruction pattern.
virtual bool operator()(bool chain, const Args &) override
Callback method.
bool matchPushBp(const Partitioner &, SgAsmX86Instruction *)
Matches "PUSH EBP" or variant.
Main namespace for the ROSE library.
Basic block callback to detect function returns.
std::vector< rose_addr_t > scanCodeAddressTable(const Partitioner &, AddressInterval &tableLimits, const AddressInterval &targetLimits, SwitchSuccessors::EntryType tableEntryType, size_t tableEntrySizeBytes, Sawyer::Optional< rose_addr_t > probableStartVa=Sawyer::Nothing(), size_t nSkippable=0)
Reads a table of code addresses.
bool matchLeaCxMemBpConst(const Partitioner &, SgAsmX86Instruction *)
Matches "LEA ECX, [EBP + constant]" or variant.
Matches an x86 MOV EDI,EDI; PUSH ESI function prologe.
virtual bool operator()(bool chain, const Args &) override
Callback method.
static Ptr instance()
Allocating constructor.
Sawyer::Optional< rose_addr_t > matchJmpConst(const Partitioner &, SgAsmX86Instruction *)
Matches "JMP constant".
virtual bool match(const Partitioner &partitioner, rose_addr_t anchor) override
Attempt to match an instruction pattern.
static Ptr instance()
Allocating constructor.
virtual std::vector< Function::Ptr > functions() const override
Returns the function(s) for the previous successful match.
Matches an x86 function prologue.
bool matchPushSi(const Partitioner &, SgAsmX86Instruction *)
Matches "PUSH SI" or variant.
Represents one Intel x86 machine instruction.
static Ptr instance()
Allocating constructor.
Base class for expressions.
bool matchMovBpSp(const Partitioner &, SgAsmX86Instruction *)
Matches "MOV EBP, ESP" or variant.
bool matchEnterAnyZero(const Partitioner &, SgAsmX86Instruction *)
Matches "ENTER x, 0".
Sawyer::SharedPointer< FunctionPrologueMatcher > Ptr
Shared-ownership pointer to a FunctionPrologueMatcher.
Sawyer::SharedPointer< BasicBlockCallback > Ptr
Shared-ownership pointer to a BasicBlockCallback.
static Ptr instance()
Allocating constructor.
static Ptr instance()
Allocating constructor.
Partitions instructions into basic blocks and functions.
virtual bool match(const Partitioner &partitioner, rose_addr_t anchor) override
Attempt to match an instruction pattern.
bool matchJmpMem(const Partitioner &, SgAsmX86Instruction *)
Matches "JMP [address]" or variant.
Matches an x86 "ENTER xxx, 0" prologue.
Matches an x86 function prologue with hot patch.
virtual std::vector< Function::Ptr > functions() const override
Returns the function(s) for the previous successful match.