From fd5a324a6a95586edd811cb3d1470e9027fc39de Mon Sep 17 00:00:00 2001 From: clc5q <clc5q@git.zephyr-software.com> Date: Tue, 18 Dec 2007 15:39:09 +0000 Subject: [PATCH] Add displ tag to stack pointer offset annotations to avoid ambiguity in case the same constant offset appears twice in an instruction. --- SMPDataFlowAnalysis.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/SMPDataFlowAnalysis.cpp b/SMPDataFlowAnalysis.cpp index b9be5af9..f97526f3 100644 --- a/SMPDataFlowAnalysis.cpp +++ b/SMPDataFlowAnalysis.cpp @@ -566,16 +566,16 @@ void SMPInstr::AnnotateStackConstants(bool UseFP, FILE *AnnotFile) { if (BaseReg == R_none) { msg("BaseReg of R_none at %x\n", this->address); } - if (BaseReg == R_sp) { // EBP cannot be BaseReg in SIB ?? + if (BaseReg == R_sp) { // ESP cannot be IndexReg // ESP-relative constant offset qfprintf(AnnotFile, - "%x %d PTRIMMEDESP STACK %d %s\n", + "%x %d PTRIMMEDESP STACK %d displ %s\n", SMPcmd.ea, SMPcmd.size, offset, disasm); } - else if (UseFP && ((IndexReg == R_bp) || (BaseReg == R_bp))) { // ESP cannot be IndexReg + else if (UseFP && ((IndexReg == R_bp) || (BaseReg == R_bp))) { // EBP-relative constant offset qfprintf(AnnotFile, - "%x %d PTRIMMEDEBP STACK %d %s\n", + "%x %d PTRIMMEDEBP STACK %d displ %s\n", SMPcmd.ea, SMPcmd.size, offset, disasm); } } @@ -584,13 +584,13 @@ void SMPInstr::AnnotateStackConstants(bool UseFP, FILE *AnnotFile) { if (BaseReg == R_sp) { // ESP-relative constant offset qfprintf(AnnotFile, - "%x %d PTRIMMEDESP STACK %d %s\n", + "%x %d PTRIMMEDESP STACK %d displ %s\n", SMPcmd.ea, SMPcmd.size, offset, disasm); } else if (UseFP && (BaseReg == R_bp)) { // EBP-relative constant offset qfprintf(AnnotFile, - "%x %d PTRIMMEDEBP STACK %d %s\n", + "%x %d PTRIMMEDEBP STACK %d displ %s\n", SMPcmd.ea, SMPcmd.size, offset, disasm); } } // end if (Opnd.hasSIB) ... else ... @@ -600,16 +600,16 @@ void SMPInstr::AnnotateStackConstants(bool UseFP, FILE *AnnotFile) { if (Opnd.hasSIB) { int BaseReg = sib_base(Opnd); short IndexReg = sib_index(Opnd); - if (BaseReg == R_sp) { // EBP cannot be BaseReg in SIB + if (BaseReg == R_sp) { // ESP cannot be IndexReg // ESP-relative constant offset qfprintf(AnnotFile, - "%x %d PTRIMMEDESP STACK %d %s\n", + "%x %d PTRIMMEDESP STACK %d displ %s\n", SMPcmd.ea, SMPcmd.size, offset, disasm); } - else if (UseFP && (IndexReg == R_bp)) { // ESP cannot be IndexReg + else if (UseFP && ((BaseReg == R_bp) || (IndexReg == R_bp))) { // EBP-relative constant offset qfprintf(AnnotFile, - "%x %d PTRIMMEDEBP STACK %d %s\n", + "%x %d PTRIMMEDEBP STACK %d displ %s\n", SMPcmd.ea, SMPcmd.size, offset, disasm); } } @@ -618,13 +618,13 @@ void SMPInstr::AnnotateStackConstants(bool UseFP, FILE *AnnotFile) { if (BaseReg == R_sp) { // ESP-relative constant offset qfprintf(AnnotFile, - "%x %d PTRIMMEDESP STACK %d %s\n", + "%x %d PTRIMMEDESP STACK %d displ %s\n", SMPcmd.ea, SMPcmd.size, offset, disasm); } else if (UseFP && (BaseReg == R_bp)) { // EBP-relative constant offset qfprintf(AnnotFile, - "%x %d PTRIMMEDEBP STACK %d %s\n", + "%x %d PTRIMMEDEBP STACK %d displ %s\n", SMPcmd.ea, SMPcmd.size, offset, disasm); } } // end if (Opnd.hasSIB) ... else ... -- GitLab