Forráskód Böngészése

Added setters/creation methods to LLOperand
Moved PROG global into Project instance. Still need to refactor all
usages of prog.
Split fseek offset calculation in frontend.cpp to allow for easier
debugging.
Added alreadyDecoded method to CIcodeRec
LONGID_TYPE now has a method matching srcDstRegMatch icode's src a dst
regs

Artur K 12 éve
szülő
commit
26b9ab1e00
16 módosított fájl, 89 hozzáadás és 16 törlés
  1. 1 1
      include/dcc.h
  2. 32 4
      include/icode.h
  3. 1 0
      src/ast.cpp
  4. 2 0
      src/backend.cpp
  5. 4 0
      src/chklib.cpp
  6. 1 1
      src/dcc.cpp
  7. 2 1
      src/disassem.cpp
  8. 8 3
      src/frontend.cpp
  9. 1 0
      src/graph.cpp
  10. 7 0
      src/icode.cpp
  11. 5 0
      src/locident.cpp
  12. 10 3
      src/parser.cpp
  13. 1 0
      src/procs.cpp
  14. 7 1
      src/project.cpp
  15. 1 1
      src/proplong.cpp
  16. 6 1
      src/scanner.cpp

+ 1 - 1
include/dcc.h

@@ -63,7 +63,7 @@ extern OPTION option;       /* Command line options             */
 
 
 #include "BinaryImage.h"
 #include "BinaryImage.h"
 
 
-extern PROG prog;   		/* Loaded program image parameters  */
+//extern PROG prog;   		/* Loaded program image parameters  */
 extern std::bitset<32> duReg[30];   /* def/use bits for registers		*/
 extern std::bitset<32> duReg[30];   /* def/use bits for registers		*/
 
 
 //extern uint32_t duReg[30];		/* def/use bits for registers		*/
 //extern uint32_t duReg[30];		/* def/use bits for registers		*/

+ 32 - 4
include/icode.h

@@ -186,10 +186,30 @@ struct LLOperand
         proc.cb=0;
         proc.cb=0;
     }
     }
     uint32_t op() const {return opz;}
     uint32_t op() const {return opz;}
-    void SetImmediateOp(uint32_t dw) {opz=dw;}
+    int64_t getImm2() const {return opz;}
+    void SetImmediateOp(uint32_t dw)
+    {
+        opz=dw;
+    }
+    eReg getReg2() {return regi;}
     bool isReg() const;
     bool isReg() const;
-
-
+    static LLOperand CreateImm2(int64_t Val)
+    {
+        LLOperand Op;
+        //Op.Kind = kImmediate;
+        //Op.ImmVal = Val;
+        Op.opz = Val;
+        return Op;
+    }
+    static LLOperand CreateReg2(unsigned Val)
+    {
+        LLOperand Op;
+//        Op.Kind = kRegister;
+//        Op.RegVal = Reg;
+        Op.regi = (eReg)Val;
+        return Op;
+    }
+    void addProcInformation(int param_count,uint32_t call_conv);
 };
 };
 struct LLInst : public llvm::MCInst //: public llvm::ilist_node<LLInst>
 struct LLInst : public llvm::MCInst //: public llvm::ilist_node<LLInst>
 {
 {
@@ -280,6 +300,14 @@ public:
         caseTbl.numEntries=0;
         caseTbl.numEntries=0;
         setOpcode(0);
         setOpcode(0);
     }
     }
+    void replaceDst(const LLOperand &with)
+    {
+        dst = with;
+    }
+    void replaceDst(eReg r)
+    {
+        dst = LLOperand::CreateReg2(r);
+    }
     ICODE *m_link;
     ICODE *m_link;
 };
 };
 
 
@@ -438,9 +466,9 @@ public:
     CIcodeRec();	// Constructor
     CIcodeRec();	// Constructor
 
 
     ICODE *	addIcode(ICODE *pIcode);
     ICODE *	addIcode(ICODE *pIcode);
-    void	SetInBB(int start, int end, BB* pnewBB);
     void	SetInBB(rCODE &rang, BB* pnewBB);
     void	SetInBB(rCODE &rang, BB* pnewBB);
     bool	labelSrch(uint32_t target, uint32_t &pIndex);
     bool	labelSrch(uint32_t target, uint32_t &pIndex);
     iterator    labelSrch(uint32_t target);
     iterator    labelSrch(uint32_t target);
     ICODE *	GetIcode(int ip);
     ICODE *	GetIcode(int ip);
+    bool        alreadyDecoded(uint32_t target);
 };
 };

+ 1 - 0
src/ast.cpp

@@ -604,6 +604,7 @@ void HlTypeSupport::performLongRemoval (eReg regi, LOCAL_ID *locId, COND_EXPR *t
 /* Returns the string located in image, formatted in C format. */
 /* Returns the string located in image, formatted in C format. */
 static std::string getString (int offset)
 static std::string getString (int offset)
 {
 {
+    PROG &prog(Project::get()->prog);
     ostringstream o;
     ostringstream o;
     int strLen, i;
     int strLen, i;
 
 

+ 2 - 0
src/backend.cpp

@@ -97,6 +97,7 @@ char *cChar (uint8_t c)
 static void printGlobVar (std::ostream &ostr,SYM * psym)
 static void printGlobVar (std::ostream &ostr,SYM * psym)
 {
 {
     int j;
     int j;
+    PROG &prog(Project::get()->prog);
     uint32_t relocOp = prog.fCOM ? psym->label : psym->label + 0x100;
     uint32_t relocOp = prog.fCOM ? psym->label : psym->label + 0x100;
 
 
     switch (psym->size)
     switch (psym->size)
@@ -162,6 +163,7 @@ void Project::writeGlobSymTable()
  * fp. */
  * fp. */
 static void writeHeader (std::ostream &_ios, char *fileName)
 static void writeHeader (std::ostream &_ios, char *fileName)
 {
 {
+    PROG &prog(Project::get()->prog);
     /* Write header information */
     /* Write header information */
     cCode.init();
     cCode.init();
     cCode.appendDecl( "/*\n");
     cCode.appendDecl( "/*\n");

+ 4 - 0
src/chklib.cpp

@@ -14,6 +14,7 @@
 #endif
 #endif
 #include <string.h>
 #include <string.h>
 #include "dcc.h"
 #include "dcc.h"
+#include "project.h"
 #include "perfhlib.h"
 #include "perfhlib.h"
 
 
 #define  NIL   -1                   /* Used like NULL, but 0 is valid */
 #define  NIL   -1                   /* Used like NULL, but 0 is valid */
@@ -297,6 +298,7 @@ static uint8_t pattMsChkstk[] =
 /* This procedure is called to initialise the library check code */
 /* This procedure is called to initialise the library check code */
 void SetupLibCheck(void)
 void SetupLibCheck(void)
 {
 {
+    PROG &prog(Project::get()->prog);
     uint16_t w, len;
     uint16_t w, len;
     int i;
     int i;
 
 
@@ -436,6 +438,7 @@ void CleanupLibCheck(void)
 */
 */
 bool LibCheck(Function & pProc)
 bool LibCheck(Function & pProc)
 {
 {
+    PROG &prog(Project::get()->prog);
     long fileOffset;
     long fileOffset;
     int h, i, j, arg;
     int h, i, j, arg;
     int Idx;
     int Idx;
@@ -619,6 +622,7 @@ static boolT locatePattern(uint8_t *source, int iMin, int iMax, uint8_t *pattern
 
 
 void STATE::checkStartup()
 void STATE::checkStartup()
 {
 {
+    PROG &prog(Project::get()->prog);
     /* This function checks the startup code for various compilers' way of
     /* This function checks the startup code for various compilers' way of
     loading DS. If found, it sets DS. This may not be needed in the future if
     loading DS. If found, it sets DS. This may not be needed in the future if
     pushing and popping of registers is implemented.
     pushing and popping of registers is implemented.

+ 1 - 1
src/dcc.cpp

@@ -12,7 +12,7 @@
 char    *asm1_name, *asm2_name;     /* Assembler output filenames     */
 char    *asm1_name, *asm2_name;     /* Assembler output filenames     */
 SYMTAB  symtab;             /* Global symbol table      			  */
 SYMTAB  symtab;             /* Global symbol table      			  */
 STATS   stats;              /* cfg statistics       				  */
 STATS   stats;              /* cfg statistics       				  */
-PROG    prog;               /* programs fields      				  */
+//PROG    prog;               /* programs fields      				  */
 OPTION  option;             /* Command line options     			  */
 OPTION  option;             /* Command line options     			  */
 //Function *   pProcList;			/* List of procedures, topologically sort */
 //Function *   pProcList;			/* List of procedures, topologically sort */
 //Function *	pLastProc;			/* Pointer to last node in procedure list */
 //Function *	pLastProc;			/* Pointer to last node in procedure list */

+ 2 - 1
src/disassem.cpp

@@ -13,7 +13,7 @@
 #include "dcc.h"
 #include "dcc.h"
 #include "symtab.h"
 #include "symtab.h"
 #include "disassem.h"
 #include "disassem.h"
-
+#include "project.h"
 // Note: for the time being, there is no interactive disassembler
 // Note: for the time being, there is no interactive disassembler
 // for unix
 // for unix
 
 
@@ -205,6 +205,7 @@ void Disassembler::disassem(Function * ppProc)
  ****************************************************************************/
  ****************************************************************************/
 void Disassembler::dis1Line(LLInst &inst,int loc_ip, int pass)
 void Disassembler::dis1Line(LLInst &inst,int loc_ip, int pass)
 {
 {
+    PROG &prog(Project::get()->prog);
     ostringstream oper_stream;
     ostringstream oper_stream;
     ostringstream hex_bytes;
     ostringstream hex_bytes;
     ostringstream result_stream;
     ostringstream result_stream;

+ 8 - 3
src/frontend.cpp

@@ -112,6 +112,7 @@ bool DccFrontend::FrontEnd ()
 ***************************************************************************/
 ***************************************************************************/
 static void displayLoadInfo(void)
 static void displayLoadInfo(void)
 {
 {
+    PROG &prog(Project::get()->prog);
     int	i;
     int	i;
 
 
     printf("File type is %s\n", (prog.fCOM)?"COM":"EXE");
     printf("File type is %s\n", (prog.fCOM)?"COM":"EXE");
@@ -145,14 +146,14 @@ static void displayLoadInfo(void)
 ****************************************************************************/
 ****************************************************************************/
 static void fill(int ip, char *bf)
 static void fill(int ip, char *bf)
 {
 {
+    PROG &prog(Project::get()->prog);
     static uint8_t type[4] = {'.', 'd', 'c', 'x'};
     static uint8_t type[4] = {'.', 'd', 'c', 'x'};
     uint8_t	i;
     uint8_t	i;
 
 
     for (i = 0; i < 16; i++, ip++)
     for (i = 0; i < 16; i++, ip++)
     {
     {
         *bf++ = ' ';
         *bf++ = ' ';
-        *bf++ = (ip < prog.cbImage)?
-                    type[(prog.map[ip >> 2] >> ((ip & 3) * 2)) & 3]: ' ';
+        *bf++ = (ip < prog.cbImage)? type[(prog.map[ip >> 2] >> ((ip & 3) * 2)) & 3]: ' ';
     }
     }
     *bf = '\0';
     *bf = '\0';
 }
 }
@@ -163,6 +164,8 @@ static void fill(int ip, char *bf)
 ****************************************************************************/
 ****************************************************************************/
 static void displayMemMap(void)
 static void displayMemMap(void)
 {
 {
+    PROG &prog(Project::get()->prog);
+
     char	c, b1[33], b2[33], b3[33];
     char	c, b1[33], b2[33], b3[33];
     uint8_t i;
     uint8_t i;
     int ip = 0;
     int ip = 0;
@@ -199,6 +202,7 @@ static void displayMemMap(void)
 ****************************************************************************/
 ****************************************************************************/
 void DccFrontend::LoadImage(Project &proj)
 void DccFrontend::LoadImage(Project &proj)
 {
 {
+    PROG &prog(Project::get()->prog);
     FILE   *fp;
     FILE   *fp;
     int		i, cb;
     int		i, cb;
     uint8_t	buf[4];
     uint8_t	buf[4];
@@ -269,7 +273,8 @@ void DccFrontend::LoadImage(Project &proj)
             }
             }
         }
         }
         /* Seek to start of image */
         /* Seek to start of image */
-        fseek(fp, (int)LH(&header.numParaHeader) * 16, SEEK_SET);
+        uint32_t start_of_image= LH(&header.numParaHeader) * 16;
+        fseek(fp, start_of_image, SEEK_SET);
     }
     }
     else
     else
     {	/* COM file
     {	/* COM file

+ 1 - 0
src/graph.cpp

@@ -172,6 +172,7 @@ CondJumps:
 
 
 void Function::markImpure()
 void Function::markImpure()
 {
 {
+    PROG &prog(Project::get()->prog);
     SYM * psym;
     SYM * psym;
     for(ICODE &icod : Icode)
     for(ICODE &icod : Icode)
     {
     {

+ 7 - 0
src/icode.cpp

@@ -46,6 +46,13 @@ bool CIcodeRec::labelSrch(uint32_t target, uint32_t &pIndex)
     pIndex=location->loc_ip;
     pIndex=location->loc_ip;
     return true;
     return true;
 }
 }
+bool CIcodeRec::alreadyDecoded(uint32_t target)
+{
+    iICODE location=labelSrch(target);
+    if(end()==location)
+            return false;
+    return true;
+}
 CIcodeRec::iterator CIcodeRec::labelSrch(uint32_t target)
 CIcodeRec::iterator CIcodeRec::labelSrch(uint32_t target)
 {
 {
     return find_if(begin(),end(),[target](ICODE &l) -> bool {return l.ll()->label==target;});
     return find_if(begin(),end(),[target](ICODE &l) -> bool {return l.ll()->label==target;});

+ 5 - 0
src/locident.cpp

@@ -8,6 +8,11 @@
 #include <cstring>
 #include <cstring>
 #include "locident.h"
 #include "locident.h"
 #include "dcc.h"
 #include "dcc.h"
+bool LONGID_TYPE::srcDstRegMatch(iICODE a, iICODE b) const
+{
+    return (a->ll()->src.getReg2()==l) and (b->ll()->dst.getReg2()==h);
+}
+
 
 
 ID::ID() : type(TYPE_UNKNOWN),illegal(false),loc(STK_FRAME),hasMacro(false)
 ID::ID() : type(TYPE_UNKNOWN),illegal(false),loc(STK_FRAME),hasMacro(false)
 {
 {

+ 10 - 3
src/parser.cpp

@@ -25,6 +25,7 @@ static uint32_t    SynthLab;
  * procedures found     */
  * procedures found     */
 void DccFrontend::parse(Project &proj)
 void DccFrontend::parse(Project &proj)
 {
 {
+    PROG &prog(proj.prog);
     STATE state;
     STATE state;
 
 
     /* Set initial state */
     /* Set initial state */
@@ -82,6 +83,7 @@ void DccFrontend::parse(Project &proj)
  * Size includes delimiter.     */
  * Size includes delimiter.     */
 int strSize (uint8_t *sym, char delim)
 int strSize (uint8_t *sym, char delim)
 {
 {
+    PROG &prog(Project::get()->prog);
     int till_end = sym-prog.Image;
     int till_end = sym-prog.Image;
     uint8_t *end_ptr=std::find(sym,sym+(prog.cbImage-(till_end)),delim);
     uint8_t *end_ptr=std::find(sym,sym+(prog.cbImage-(till_end)),delim);
     return end_ptr-sym+1;
     return end_ptr-sym+1;
@@ -93,12 +95,13 @@ Function *fakeproc=Function::Create(0,0,"fake");
  * using a depth first search.     */
  * using a depth first search.     */
 void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
 void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
 {
 {
+    PROG &prog(Project::get()->prog);
     ICODE   _Icode, *pIcode;     /* This gets copied to pProc->Icode[] later */
     ICODE   _Icode, *pIcode;     /* This gets copied to pProc->Icode[] later */
     ICODE   eIcode;             /* extra icodes for iDIV, iIDIV, iXCHG */
     ICODE   eIcode;             /* extra icodes for iDIV, iIDIV, iXCHG */
     SYM *    psym;
     SYM *    psym;
     uint32_t   offset;
     uint32_t   offset;
     eErrorId err;
     eErrorId err;
-    boolT   done = false;
+    bool   done = false;
     SYMTAB &global_symbol_table(g_proj.symtab);
     SYMTAB &global_symbol_table(g_proj.symtab);
     if (name.find("chkstk") != string::npos)
     if (name.find("chkstk") != string::npos)
     {
     {
@@ -376,6 +379,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
 /* process_JMP - Handles JMPs, returns true if we should end recursion  */
 /* process_JMP - Handles JMPs, returns true if we should end recursion  */
 boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGraph)
 boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGraph)
 {
 {
+    PROG &prog(Project::get()->prog);
     static uint8_t i2r[4] = {rSI, rDI, rBP, rBX};
     static uint8_t i2r[4] = {rSI, rDI, rBP, rBX};
     ICODE       _Icode;
     ICODE       _Icode;
     uint32_t       cs, offTable, endTable;
     uint32_t       cs, offTable, endTable;
@@ -503,6 +507,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
 
 
 boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *pstate)
 boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *pstate)
 {
 {
+    PROG &prog(Project::get()->prog);
     ICODE &last_insn(Icode.back());
     ICODE &last_insn(Icode.back());
     STATE localState;     /* Local copy of the machine state */
     STATE localState;     /* Local copy of the machine state */
     uint32_t off;
     uint32_t off;
@@ -633,6 +638,7 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
 /* process_MOV - Handles state changes due to simple assignments    */
 /* process_MOV - Handles state changes due to simple assignments    */
 static void process_MOV(LLInst & ll, STATE * pstate)
 static void process_MOV(LLInst & ll, STATE * pstate)
 {
 {
+    PROG &prog(Project::get()->prog);
     SYM *  psym, *psym2;        /* Pointer to symbol in global symbol table */
     SYM *  psym, *psym2;        /* Pointer to symbol in global symbol table */
     uint8_t  dstReg = ll.dst.regi;
     uint8_t  dstReg = ll.dst.regi;
     uint8_t  srcReg = ll.src.regi;
     uint8_t  srcReg = ll.src.regi;
@@ -742,6 +748,7 @@ void STKFRAME::updateFrameOff ( int16_t off, int _size, uint16_t duFlag)
  *      symbol table, or Null if it's not a direct memory offset.  */
  *      symbol table, or Null if it's not a direct memory offset.  */
 static SYM * lookupAddr (LLOperand *pm, STATE *pstate, int size, uint16_t duFlag)
 static SYM * lookupAddr (LLOperand *pm, STATE *pstate, int size, uint16_t duFlag)
 {
 {
+    PROG &prog(Project::get()->prog);
     int     i;
     int     i;
     SYM *    psym=nullptr;
     SYM *    psym=nullptr;
     uint32_t   operand;
     uint32_t   operand;
@@ -816,10 +823,10 @@ void STATE::setState(uint16_t reg, int16_t value)
     replaces *pIndex with an icode index */
     replaces *pIndex with an icode index */
 
 
 
 
-
-static void setBits(int16_t type, uint32_t start, uint32_t len)
 /* setBits - Sets memory bitmap bits for BM_CODE or BM_DATA (additively) */
 /* setBits - Sets memory bitmap bits for BM_CODE or BM_DATA (additively) */
+static void setBits(int16_t type, uint32_t start, uint32_t len)
 {
 {
+    PROG &prog(Project::get()->prog);
     uint32_t   i;
     uint32_t   i;
 
 
     if (start < (uint32_t)prog.cbImage)
     if (start < (uint32_t)prog.cbImage)

+ 1 - 0
src/procs.cpp

@@ -263,6 +263,7 @@ COND_EXPR *CallType::toId()
  * the actual argument gets modified */
  * the actual argument gets modified */
 void adjustActArgType (COND_EXPR *exp, hlType forType, Function * pproc)
 void adjustActArgType (COND_EXPR *exp, hlType forType, Function * pproc)
 {
 {
+    PROG &prog(Project::get()->prog);
     hlType actType;
     hlType actType;
     int offset, offL;
     int offset, offL;
 
 

+ 7 - 1
src/project.cpp

@@ -61,7 +61,13 @@ const std::string &Project::symbolName(size_t idx)
     assert(validSymIdx(idx));
     assert(validSymIdx(idx));
     return symtab[idx].name;
     return symtab[idx].name;
 }
 }
-Project *get()
+Project *Project::get()
 {
 {
     return &g_proj;
     return &g_proj;
 }
 }
+
+
+SourceMachine *Project::machine()
+{
+    return nullptr;
+}

+ 1 - 1
src/proplong.cpp

@@ -480,7 +480,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
              * This is better code than HLI_JCOND (HI(regH:regL) | LO(regH:regL)) */
              * This is better code than HLI_JCOND (HI(regH:regL) | LO(regH:regL)) */
         else if (pIcode->ll()->match(iOR) && (next1 != pEnd) && (isJCond ((llIcode)next1->ll()->getOpcode())))
         else if (pIcode->ll()->match(iOR) && (next1 != pEnd) && (isJCond ((llIcode)next1->ll()->getOpcode())))
         {
         {
-            if ((pIcode->ll()->dst.regi == pLocId.id.longId.h) && (pIcode->ll()->src.regi == pLocId.id.longId.l))
+            if (pLocId.id.longId.srcDstRegMatch(pIcode,pIcode))
             {
             {
                 asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
                 asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
                 asgn.rhs = COND_EXPR::idKte (0, 4);	/* long 0 */
                 asgn.rhs = COND_EXPR::idKte (0, 4);	/* long 0 */

+ 6 - 1
src/scanner.cpp

@@ -9,6 +9,7 @@
 
 
 #include "dcc.h"
 #include "dcc.h"
 #include "scanner.h"
 #include "scanner.h"
+#include "project.h"
 /*  Parser flags  */
 /*  Parser flags  */
 #define TO_REG      0x000100    /* rm is source  */
 #define TO_REG      0x000100    /* rm is source  */
 #define S_EXT       0x000200    /* sign extend   */
 #define S_EXT       0x000200    /* sign extend   */
@@ -326,6 +327,7 @@ static ICODE * pIcode;		/* Ptr to Icode record filled in by scan() */
  ****************************************************************************/
  ****************************************************************************/
 eErrorId scan(uint32_t ip, ICODE &p)
 eErrorId scan(uint32_t ip, ICODE &p)
 {
 {
+    PROG &prog(Project::get()->prog);
     int  op;
     int  op;
     p = ICODE();
     p = ICODE();
     p.type = LOW_LEVEL;
     p.type = LOW_LEVEL;
@@ -367,8 +369,9 @@ eErrorId scan(uint32_t ip, ICODE &p)
 /***************************************************************************
 /***************************************************************************
  relocItem - returns true if uint16_t pointed at is in relocation table
  relocItem - returns true if uint16_t pointed at is in relocation table
  **************************************************************************/
  **************************************************************************/
-static boolT relocItem(uint8_t *p)
+static bool relocItem(uint8_t *p)
 {
 {
+    PROG &prog(Project::get()->prog);
     int		i;
     int		i;
     uint32_t	off = p - prog.Image;
     uint32_t	off = p - prog.Image;
 
 
@@ -736,6 +739,7 @@ static void dispM(int i)
  ****************************************************************************/
  ****************************************************************************/
 static void dispN(int )
 static void dispN(int )
 {
 {
+    PROG &prog(Project::get()->prog);
     long off = (short)getWord();	/* Signed displacement */
     long off = (short)getWord();	/* Signed displacement */
 
 
     /* Note: the result of the subtraction could be between 32k and 64k, and
     /* Note: the result of the subtraction could be between 32k and 64k, and
@@ -751,6 +755,7 @@ static void dispN(int )
  ***************************************************************************/
  ***************************************************************************/
 static void dispS(int )
 static void dispS(int )
 {
 {
+    PROG &prog(Project::get()->prog);
     long off = signex(*pInst++); 	/* Signed displacement */
     long off = signex(*pInst++); 	/* Signed displacement */
 
 
     pIcode->ll()->src.SetImmediateOp((uint32_t)(off + (unsigned)(pInst - prog.Image)));
     pIcode->ll()->src.SetImmediateOp((uint32_t)(off + (unsigned)(pInst - prog.Image)));