1#ifndef ROSE_BinaryAnalysis_Partitioner2_ModulesX86_H
2#define ROSE_BinaryAnalysis_Partitioner2_ModulesX86_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Partitioner2/JumpTable.h>
8#include <Rose/BinaryAnalysis/Partitioner2/Modules.h>
11namespace BinaryAnalysis {
12namespace Partitioner2 {
42 virtual std::vector<FunctionPtr>
functions()
const override;
57 virtual std::vector<FunctionPtr>
functions()
const override {
return std::vector<FunctionPtr>(1, function_); }
72 virtual std::vector<FunctionPtr>
functions()
const override;
82 virtual std::vector<FunctionPtr>
functions()
const override {
return std::vector<FunctionPtr>(1, function_); }
92 virtual std::vector<FunctionPtr>
functions()
const override {
return std::vector<FunctionPtr>(1, function_); }
128 std::string matcherName_;
131 size_t entrySizeBytes_ = 4;
136 std::vector<uint8_t> indexes_;
145 void addToPartitioner(
const Args&,
const std::set<Address> &successors)
const;
157 void parseJumpTable(
const Args&);
15namespace ModulesX86 {
…}
Base class for adjusting basic blocks during discovery.
BasicBlockCallbackPtr Ptr
Shared-ownership pointer to a BasicBlockCallback.
Base class for matching function prologues.
FunctionPrologueMatcherPtr Ptr
Shared-ownership pointer to a FunctionPrologueMatcher.
JumpTablePtr Ptr
Shared ownership pointer.
EntryType
How target addresses are computed from entries.
@ ABSOLUTE
Target is entry plus (nominally zero) constant offset.
Basic block callback to detect function returns.
static Ptr instance()
Allocating constructor.
virtual bool operator()(bool chain, const Args &) override
Callback method.
Matches an x86 MOV EDI,EDI; PUSH ESI function prologe.
virtual bool match(const PartitionerConstPtr &, Address anchor) override
Attempt to match an instruction pattern.
virtual std::vector< FunctionPtr > functions() const override
Returns the function(s) for the previous successful match.
static Ptr instance()
Allocating constructor.
Matches an x86 "ENTER xxx, 0" prologue.
virtual std::vector< FunctionPtr > functions() const override
Returns the function(s) for the previous successful match.
virtual bool match(const PartitionerConstPtr &, Address anchor) override
Attempt to match an instruction pattern.
static Ptr instance()
Allocating constructor.
Matches an x86 function prologue with hot patch.
virtual bool match(const PartitionerConstPtr &, Address anchor) override
Attempt to match an instruction pattern.
static Ptr instance()
Allocating constructor.
virtual std::vector< FunctionPtr > functions() const override
Returns the function(s) for the previous successful match.
Match RET followed by PUSH with intervening no-op padding.
virtual bool match(const PartitionerConstPtr &, Address anchor) override
Attempt to match an instruction pattern.
static Ptr instance()
Allocating constructor.
virtual std::vector< FunctionPtr > functions() const override
Returns the function(s) for the previous successful match.
Matches an x86 function prologue.
virtual std::vector< FunctionPtr > functions() const override
Returns the function(s) for the previous successful match.
static Ptr instance()
Allocating constructor.
virtual bool match(const PartitionerConstPtr &, Address anchor) override
Attempt to match an instruction pattern.
Basic block callback to detect "switch" statements.
static Ptr instance()
Allocating constructor.
virtual bool operator()(bool chain, const Args &) override
Callback method.
Holds a value or nothing.
Base class for expressions.
Base class for machine instructions.
Represents one Intel x86 machine instruction.
Sawyer::Optional< Address > findTableBase(SgAsmExpression *)
Try to match a base+offset expression.
bool matchMovBpSp(const PartitionerConstPtr &, SgAsmX86Instruction *)
Matches "MOV EBP, ESP" or variant.
bool matchEnterAnyZero(const PartitionerConstPtr &, SgAsmX86Instruction *)
Matches "ENTER x, 0".
bool matchPushBp(const PartitionerConstPtr &, SgAsmX86Instruction *)
Matches "PUSH EBP" or variant.
bool matchMovDiDi(const PartitionerConstPtr &, SgAsmX86Instruction *)
Matches "MOV EDI, EDI" or variant.
bool matchPushSi(const PartitionerConstPtr &, SgAsmX86Instruction *)
Matches "PUSH SI" or variant.
Sawyer::Optional< Address > matchJmpConst(const PartitionerConstPtr &, SgAsmX86Instruction *)
Matches "JMP constant".
bool matchJmpMem(const PartitionerConstPtr &, SgAsmX86Instruction *)
Matches "JMP [address]" or variant.
bool matchLeaCxMemBpConst(const PartitionerConstPtr &, SgAsmX86Instruction *)
Matches "LEA ECX, [EBP + constant]" or variant.
std::uint64_t Address
Address.
Arguments passed to the callback.