Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
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
Zipr Toolchain
Commits
3743e02e
Commit
3743e02e
authored
12 years ago
by
bdr7fv
Browse files
Options
Downloads
Patches
Plain Diff
PN now uses the new libIRDB assembly registry to assemble instructions.
Former-commit-id: ad5320f6d081034e762b176a8b3a458fd3bbf603
parent
d1951790
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/transforms/PNTransformDriver.cpp
+30
-2
30 additions, 2 deletions
tools/transforms/PNTransformDriver.cpp
tools/transforms/Rewrite_Utility.cpp
+3
-1
3 additions, 1 deletion
tools/transforms/Rewrite_Utility.cpp
with
33 additions
and
3 deletions
tools/transforms/PNTransformDriver.cpp
+
30
−
2
View file @
3743e02e
...
...
@@ -896,9 +896,12 @@ bool PNTransformDriver::Canary_Rewrite(PNStackLayout *orig_layout, Function_t *f
//undo_list[instr] = instr->GetDataBits();
//undo_list[instr] = copyInstruction(instr);
undo_list
[
func
->
GetName
()][
instr
]
=
copyInstruction
(
instr
);
virp
->
RegisterAssembly
(
instr
,
disasm_str
);
/*
if(!instr->Assemble(disasm_str))
return false;
*/
stack_alloc
=
true
;
for
(
unsigned
int
i
=
0
;
i
<
canaries
.
size
();
i
++
)
...
...
@@ -1079,8 +1082,13 @@ inline bool PNTransformDriver::Instruction_Rewrite(PNStackLayout *layout, Instru
//undo_list[instr] = instr->GetDataBits();
//undo_list[instr] = copyInstruction(instr);
undo_list
[
instr
->
GetFunction
()
->
GetName
()][
instr
]
=
copyInstruction
(
instr
);
virp
->
RegisterAssembly
(
instr
,
disasm_str
);
/*
if(!instr->Assemble(disasm_str))
return false;
*/
//stack_alloc = true;
}
...
...
@@ -1132,8 +1140,12 @@ inline bool PNTransformDriver::Instruction_Rewrite(PNStackLayout *layout, Instru
//undo_list[instr] = copyInstruction(instr);
undo_list
[
instr
->
GetFunction
()
->
GetName
()][
instr
]
=
copyInstruction
(
instr
);
virp
->
RegisterAssembly
(
instr
,
disasm_str
);
/*
if(!instr->Assemble(disasm_str.c_str()))
return false;
*/
}
//TODO: the regular expression order does matter, scaled must come first, change the regex so this doesn't matter
...
...
@@ -1165,8 +1177,12 @@ inline bool PNTransformDriver::Instruction_Rewrite(PNStackLayout *layout, Instru
//undo_list[instr] = copyInstruction(instr);
undo_list
[
instr
->
GetFunction
()
->
GetName
()][
instr
]
=
copyInstruction
(
instr
);
virp
->
RegisterAssembly
(
instr
,
disasm_str
);
/*
if(!instr->Assemble(disasm_str.c_str()))
return false;
*/
}
//TODO: the regular expression order does matter, scaled must come first, change the regex so this doesn't matter
//for lea esp, [ebp-<const>] it is assumed the <const> will not be in the stack frame, so it should be ignored.
...
...
@@ -1204,8 +1220,12 @@ inline bool PNTransformDriver::Instruction_Rewrite(PNStackLayout *layout, Instru
//undo_list[instr] = copyInstruction(instr);
undo_list
[
instr
->
GetFunction
()
->
GetName
()][
instr
]
=
copyInstruction
(
instr
);
virp
->
RegisterAssembly
(
instr
,
disasm_str
);
/*
if(!instr->Assemble(disasm_str.c_str()))
return false;
*/
}
//if we get an instruction where ebp is the index, transform it using the
...
...
@@ -1246,9 +1266,13 @@ inline bool PNTransformDriver::Instruction_Rewrite(PNStackLayout *layout, Instru
//undo_list[instr] = instr->GetDataBits();
//undo_list[instr] = copyInstruction(instr);
undo_list
[
instr
->
GetFunction
()
->
GetName
()][
instr
]
=
copyInstruction
(
instr
);
virp
->
RegisterAssembly
(
instr
,
disasm_str
);
/*
if(!instr->Assemble(disasm_str.c_str()))
return false;
*/
}
else
if
(
regexec
(
&
(
pn_regex
.
regex_stack_dealloc
),
disasm_str
.
c_str
(),
5
,
pmatch
,
0
)
==
0
)
{
...
...
@@ -1281,8 +1305,12 @@ inline bool PNTransformDriver::Instruction_Rewrite(PNStackLayout *layout, Instru
//undo_list[instr] = copyInstruction(instr);
undo_list
[
instr
->
GetFunction
()
->
GetName
()][
instr
]
=
copyInstruction
(
instr
);
cerr
<<
"PNTransformDriver: New Instruction = "
<<
disasm_str
<<
endl
;
virp
->
RegisterAssembly
(
instr
,
disasm_str
);
/*
if (!instr->Assemble(disasm_str))
return false;
*/
}
else
cerr
<<
"PNTransformDriver: No Pattern Match"
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
tools/transforms/Rewrite_Utility.cpp
+
3
−
1
View file @
3743e02e
...
...
@@ -129,7 +129,9 @@ void setInstructionAssembly(FileIR_t* virp,Instruction_t *p_instr, string p_asse
if
(
p_instr
==
NULL
)
return
;
///TODO: what if bad assembly?
p_instr
->
Assemble
(
p_assembly
);
virp
->
RegisterAssembly
(
p_instr
,
p_assembly
);
// p_instr->Assemble(p_assembly);
p_instr
->
SetComment
(
p_instr
->
getDisassembly
());
p_instr
->
SetFallthrough
(
p_fallThrough
);
p_instr
->
SetTarget
(
p_target
);
...
...
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