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
Commits
f8e2d3f8
Commit
f8e2d3f8
authored
17 years ago
by
clc5q
Browse files
Options
Downloads
Patches
Plain Diff
Handle DEFs/USEs due to REP/REPNE prefixes.
parent
a691a88e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SMPInstr.cpp
+26
-3
26 additions, 3 deletions
SMPInstr.cpp
with
26 additions
and
3 deletions
SMPInstr.cpp
+
26
−
3
View file @
f8e2d3f8
...
...
@@ -582,11 +582,34 @@ void SMPInstr::MDFixupDefUseLists(void) {
}
// end if (o_phrase or o_displ operand)
}
// end for (all operands)
// Next, handle repeat prefices in the instructions.
// Next, handle repeat prefices in the instructions. The Intel REPE/REPZ prefix
// is just the text printed for SCAS/CMPS instructions that have a REP prefix.
// Only two distinct prefix codes are actually defined: REP and REPNE/REPNZ, and
// REPNE/REPNZ only applies to SCAS and CMPS instructions.
bool
HasRepPrefix
=
(
0
!=
(
this
->
SMPcmd
.
auxpref
&
aux_rep
));
bool
HasRepnePrefix
=
(
0
!=
(
this
->
SMPcmd
.
auxpref
&
aux_repne
));
if
(
HasRepPrefix
&&
HasRepnePrefix
)
msg
(
"REP and REPNE both present at %x %s
\n
"
,
this
->
GetAddr
(),
this
->
GetDisasm
());
if
(
HasRepPrefix
||
HasRepnePrefix
)
{
// All repeating instructions use ECX as the countdown register.
op_t
BaseOpnd
;
BaseOpnd
.
type
=
o_reg
;
// Change type and reg fields
BaseOpnd
.
reg
=
R_cx
;
BaseOpnd
.
hasSIB
=
0
;
BaseOpnd
.
clr_showed
();
this
->
Defs
.
SetRef
(
BaseOpnd
);
this
->
Uses
.
SetRef
(
BaseOpnd
);
}
if
(
!
this
->
DefsFlags
&&
((
this
->
SMPcmd
.
itype
==
NN_cmps
)
||
(
this
->
SMPcmd
.
itype
==
NN_scas
)))
{
// REPE and REPNE define the flags in addition to ECX.
op_t
BaseOpnd
;
BaseOpnd
.
type
=
o_reg
;
// Change type and reg fields
BaseOpnd
.
reg
=
X86_FLAGS_REG
;
BaseOpnd
.
hasSIB
=
0
;
BaseOpnd
.
clr_showed
();
this
->
Defs
.
SetRef
(
BaseOpnd
);
this
->
DefsFlags
=
true
;
}
// Now, handle special instruction categories that have implicit operands.
if
(
NN_cmpxchg
==
this
->
SMPcmd
.
itype
)
{
...
...
@@ -640,11 +663,11 @@ void SMPInstr::MDFixupDefUseLists(void) {
if
(
this
->
type
==
COND_BRANCH
)
{
assert
(
SMPUsesFlags
[
this
->
SMPcmd
.
itype
]);
}
if
(
SMPDefsFlags
[
this
->
SMPcmd
.
itype
])
{
if
(
!
this
->
DefsFlags
&&
SMPDefsFlags
[
this
->
SMPcmd
.
itype
])
{
this
->
MDAddRegDef
(
X86_FLAGS_REG
,
false
);
this
->
DefsFlags
=
true
;
}
if
(
SMPUsesFlags
[
this
->
SMPcmd
.
itype
])
{
if
(
!
this
->
UsesFlags
&&
SMPUsesFlags
[
this
->
SMPcmd
.
itype
])
{
this
->
MDAddRegUse
(
X86_FLAGS_REG
,
false
);
this
->
UsesFlags
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment