Skip to content
Snippets Groups Projects
Commit 3743e02e authored by bdr7fv's avatar bdr7fv
Browse files

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
......@@ -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;
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment