Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SMPStaticAnalyzer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
SMPStaticAnalyzer
Compare revisions
499b37f566af0f446575e0802d8eccbed42b9f58 to 72e2f13657cf82d61a9148c6cb9ed3b60e86b12c
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
opensrc/SMPStaticAnalyzer
Select target project
No results found
72e2f13657cf82d61a9148c6cb9ed3b60e86b12c
Select Git revision
Swap
Target
opensrc/SMPStaticAnalyzer
Select target project
opensrc/SMPStaticAnalyzer
1 result
499b37f566af0f446575e0802d8eccbed42b9f58
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Instruction decoding fixes.
· 1d93cfc3
Clark Coleman
authored
6 years ago
1d93cfc3
Increase robustness, fix crashes.
· 72e2f136
Clark Coleman
authored
6 years ago
72e2f136
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/base/SMPBasicBlock.cpp
+4
-0
4 additions, 0 deletions
src/base/SMPBasicBlock.cpp
src/base/SMPFunction.cpp
+15
-7
15 additions, 7 deletions
src/base/SMPFunction.cpp
src/interfaces/irdb/STARS_IRDB_Instruction.cpp
+23
-12
23 additions, 12 deletions
src/interfaces/irdb/STARS_IRDB_Instruction.cpp
with
42 additions
and
19 deletions
src/base/SMPBasicBlock.cpp
View file @
72e2f136
...
...
@@ -1562,6 +1562,7 @@ STARS_ea_t SMPBasicBlock::GetUltimateDefAddr(const STARSOpndTypePtr &UseOp, STAR
SMPInstr *CurrInst = this->GetFunc()->GetInstFromAddr(DefAddr);
assert(NULL != CurrInst);
bool NewDefMoveOp = false;
#if 0
if (CurrInst->MDIsMoveInstr()) {
DefMoveOp = CurrInst->GetMoveSource();
DefMoveOp = CloneIfNecessary(DefMoveOp, this->GetFunc()->UsesFramePointer());
...
...
@@ -1577,6 +1578,9 @@ STARS_ea_t SMPBasicBlock::GetUltimateDefAddr(const STARSOpndTypePtr &UseOp, STAR
DefMoveOp = CurrInst->MakeRegOpnd(LeaAddrReg); // convert to RegOp
}
}
#else
NewDefMoveOp = CurrInst->IsSimpleCopy(DefMoveOp);
#endif
// We recurse if the DefMoveOp is a non-stack-ptr-reg, including the LeaMemUseOp being
// a single register (e.g. base but no index: lea ebx,[edx] is just a move in disguise)
bool ValidOperand = NewDefMoveOp && ((DefMoveOp->IsRegOp() && (!MDIsStackPtrReg(DefMoveOp->GetReg(), UseFP)))
...
...
This diff is collapsed.
Click to expand it.
src/base/SMPFunction.cpp
View file @
72e2f136
...
...
@@ -16223,6 +16223,8 @@ bool SMPFunction::ComputeReturnTargets(bool FirstIteration) {
if (NULL == FuncInfo) {
SMP_msg("SERIOUS WARNING: ComputeReturnTargets: Call location %llx not in a function.\n",
(unsigned long long) CallAddr);
this->SetIsCalledFromOrphanedCode();
// IncompleteCaller = true;
continue;
}
// Get first addr in func and map to SMPFunction *.
...
...
@@ -16732,35 +16734,41 @@ void SMPFunction::EmitReturnTargetAnnotations(void) {
if (success)
ReturnProcessed = true;
set<STARS_ea_t>::const_iterator RetTargIter;
for (RetTargIter = this->ReturnTargets.cbegin(); RetTargIter != this->ReturnTargets.cend(); ++RetTargIter) {
STARS_ea_t RetTargetAddr = (*RetTargIter);
for (const STARS_ea_t RetTargetAddr : this->ReturnTargets) {
bool TailCallFlag = (this->TailReturnTargets.find(RetTargetAddr) != this->TailReturnTargets.end());
success &= global_STARS_program->PrintReturnInstXref(ReturnInstAddr, RetTargetAddr, RetInstSize, TailCallFlag);
}
if (success && (!(this->IsPossibleIndirectCallTarget() || this->MultipleEntryPoints || OrphanCodeProblem))) {
global_STARS_program->PrintCodeToCodeXrefComplete(ReturnInstAddr, RetInstSize, this->ReturnTargets.size(), ZST_RETURN);
++STARS_ReturnSetComplete;
bool RetDeadRegsProblem = false;
if (!RetDeadRegsComputed) {
// Compute intersection of dead regs bitsets for each return target.
for (set<STARS_ea_t>::const_iterator RetTargIter = this->ReturnTargets.cbegin(); RetTargIter != this->ReturnTargets.cend(); ++RetTargIter) {
STARS_ea_t RetTargetAddr = (*RetTargIter);
for (const STARS_ea_t RetTargetAddr : this->ReturnTargets) {
STARS_Function_t *FuncInfo = SMP_get_func(RetTargetAddr);
assert(NULL != FuncInfo);
if (nullptr == FuncInfo) {
RetDeadRegsProblem = true;
SMP_msg("ERROR: Return target ID %llx not in any function.\n", (uint64_t) RetTargetAddr);
break; // cannot produce valid set
}
// Get first addr in func and map to SMPFunction *.
STARS_ea_t FirstAddrOfCaller = FuncInfo->get_startEA();
SMPFunction *CallingFunc = this->GetProg()->FindFunction(FirstAddrOfCaller);
assert(nullptr != CallingFunc);
SMPInstr *RetTargetInst = CallingFunc->GetInstFromAddr(RetTargetAddr);
assert(nullptr != RetTargetInst);
if (!RetDeadRegsComputed) {
if (!RetDeadRegsComputed) {
// First target, initialize by OR-ing into empty bitset.
ReturnDeadRegs |= RetTargetInst->GetDeadRegsSet();
RetDeadRegsComputed = true;
}
else {
else {
// Not first target, AND into bitset to get regs dead at all call sites.
ReturnDeadRegs &= RetTargetInst->GetDeadRegsSet();
}
}
}
if (RetDeadRegsProblem) {
ReturnDeadRegs.reset();
}
ReturnInst->SetDeadRegsSet(ReturnDeadRegs);
}
else {
...
...
This diff is collapsed.
Click to expand it.
src/interfaces/irdb/STARS_IRDB_Instruction.cpp
View file @
72e2f136
...
...
@@ -43,6 +43,29 @@ uint16_t STARS_IRDB_Instruction_t::GetIDAOpcode(void)
return
this
->
IDAOpcode
;
// optimization
}
// Before we allow the CHECK_FOR_INSN and CHECK_FOR_INSN_RENAME macros
// to make the bulk of the decisions, we need to identify opcodes that
// have conflicting mnemonics.
//
// movsd could be a move-string opcode with each move being a dword, or
// it could be move-scalar-double-precision, an SSE2/AVX opcode.
// We will look at operands to catch the floating-point case before
// it gets turned into a move-string by CHECK_FOR_INSN_RENAME.
if
(
this
->
disasm
.
getMnemonic
()
==
string
(
"movsd"
))
{
const
auto
my_disasm
=
DecodedInstruction_t
(
this
->
irdb_insn
);
bool
Operand0SSEorAVX
=
(
my_disasm
.
hasOperand
(
0
)
&&
(
my_disasm
.
getOperand
(
0
).
isSseRegister
()
||
my_disasm
.
getOperand
(
0
).
isAvxRegister
()));
bool
Operand1SSEorAVX
=
(
my_disasm
.
hasOperand
(
1
)
&&
(
my_disasm
.
getOperand
(
1
).
isSseRegister
()
||
my_disasm
.
getOperand
(
1
).
isAvxRegister
()));
if
(
Operand0SSEorAVX
||
Operand1SSEorAVX
)
{
this
->
IDAOpcode
=
STARS_NN_movsd
;
this
->
IDAOpcodeCached
=
true
;
return
this
->
IDAOpcode
;
}
}
#define CHECK_FOR_INSN(token) \
if (disasm.getMnemonic() == string(#token) ) {
/*string(disasm.Instruction.Mnemonic) == string(#token) + " ") */
\
this->IDAOpcode = STARS_NN_##token; \
...
...
@@ -363,7 +386,6 @@ uint16_t STARS_IRDB_Instruction_t::GetIDAOpcode(void)
CHECK_FOR_INSN
(
cmovl
);
CHECK_FOR_INSN
(
cmovle
);
CHECK_FOR_INSN
(
cmovnb
);
CHECK_FOR_INSN
(
cmovnb
);
CHECK_FOR_INSN
(
cmovno
);
CHECK_FOR_INSN
(
cmovnp
);
CHECK_FOR_INSN
(
cmovns
);
...
...
@@ -374,21 +396,10 @@ uint16_t STARS_IRDB_Instruction_t::GetIDAOpcode(void)
CHECK_FOR_INSN
(
cmovz
);
CHECK_FOR_INSN_RENAME
(
cmova
,
"cmovnbe"
);
CHECK_FOR_INSN_RENAME
(
cmovb
,
"cmovb"
);
CHECK_FOR_INSN_RENAME
(
cmovbe
,
"cmovbe"
);
CHECK_FOR_INSN_RENAME
(
cmovg
,
"cmovnle"
);
CHECK_FOR_INSN_RENAME
(
cmovge
,
"cmovnl"
);
CHECK_FOR_INSN_RENAME
(
cmovl
,
"cmovl"
);
CHECK_FOR_INSN_RENAME
(
cmovle
,
"cmovle"
);
CHECK_FOR_INSN_RENAME
(
cmovnb
,
"cmovnb"
);
CHECK_FOR_INSN_RENAME
(
cmovnb
,
"cmovae"
);
CHECK_FOR_INSN_RENAME
(
cmovno
,
"cmovno"
);
CHECK_FOR_INSN_RENAME
(
cmovnp
,
"cmovnp"
);
CHECK_FOR_INSN_RENAME
(
cmovns
,
"cmovns"
);
CHECK_FOR_INSN_RENAME
(
cmovnz
,
"cmovne"
);
CHECK_FOR_INSN_RENAME
(
cmovo
,
"cmovo"
);
CHECK_FOR_INSN_RENAME
(
cmovp
,
"cmovp"
);
CHECK_FOR_INSN_RENAME
(
cmovs
,
"cmovs"
);
CHECK_FOR_INSN_RENAME
(
cmovz
,
"cmove"
);
CHECK_FOR_INSN
(
fcmovb
);
CHECK_FOR_INSN
(
fcmove
);
...
...
This diff is collapsed.
Click to expand it.