pentiumfrontend.h

Go to the documentation of this file.
00001 /*
00002  *  $Revision: 1.15 $ // 1.12.6.1
00003  */
00004 #ifndef PENTFRONTEND_H
00005 #define PENTFRONTEND_H
00006 
00007 #include "frontend.h"
00008 class Statement;
00009 
00010 
00011 // Class PentiumFrontEnd: derived from FrontEnd, with source machine specific
00012 // behaviour
00013 
00014 class PentiumDecoder;
00015 
00016 class PentiumFrontEnd : public FrontEnd
00017 {
00018 public:
00019     /*
00020      * Constructor. Takes some parameters to save passing these around a lot
00021      */
00022                     PentiumFrontEnd(BinaryFile *pBF, Prog* prog, BinaryFileFactory* pbff);
00023 
00024 virtual             ~PentiumFrontEnd();
00025 
00026 virtual platform    getFrontEndId() { return PLAT_PENTIUM; }
00027 
00028     /*
00029      * processProc. This is the main function for decoding a procedure.
00030      * This overrides the base class processProc to do source machine specific things (but often calls the base class
00031      * to do most of the work. Sparc is an exception)
00032      * If spec is true, this is a speculative decode (so give up on any invalid instruction)
00033      * Returns true on a good decode
00034      */
00035 virtual bool        processProc(ADDRESS uAddr, UserProc* pProc, std::ofstream &os, bool frag = false,
00036                         bool spec = false);
00037 
00038 virtual std::vector<Exp*> &getDefaultParams();
00039 virtual std::vector<Exp*> &getDefaultReturns();
00040 
00041 virtual ADDRESS     getMainEntryPoint( bool &gotMain );
00042 
00043 private:
00044 
00045     /*
00046      * Process an F(n)STSW instruction.
00047      */
00048     bool    processStsw(std::list<RTL*>::iterator& rit, std::list<RTL*>* pRtls, PBB pBB, Cfg* pCfg);
00049 
00050     /*
00051      * Emit a set instruction.
00052      */
00053     void    emitSet(std::list<RTL*>* pRtls, std::list<RTL*>::iterator& itRtl, ADDRESS uAddr, Exp* pLHS, Exp* cond);
00054 
00055     /*
00056      * Handle the case of being in state 23 and encountering a set instruction.
00057      */
00058     void    State25(Exp* pLHS, Exp* pRHS, std::list<RTL*>* pRtls, std::list<RTL*>::iterator& rit, ADDRESS uAddr);
00059 
00060     int idPF;              // Parity flag
00061 
00062     /*
00063      * Little simpler, just replaces FPUSH and FPOP with more complex
00064      * semantics.
00065      */
00066     void    processFloatCode(Cfg* pCfg);
00067 
00068     /*
00069      * Process a BB and its successors for floating point code
00070      */
00071     void    processFloatCode(PBB pBB, int& tos, Cfg* pCfg);
00072 
00073     /*
00074      * Process away %rpt and %skip in string instructions
00075      */
00076     void    processStringInst(UserProc* proc);
00077 
00078     /*
00079      * Process for overlapped registers
00080      */
00081     void    processOverlapped(UserProc* proc);
00082 
00083     /*
00084      * Check a HLCall for a helper function, and replace with appropriate
00085      *  semantics if possible
00086      */
00087     bool    helperFunc(ADDRESS dest, ADDRESS addr, std::list<RTL*>* lrtl);
00088 
00089     bool    isStoreFsw(Statement* s);
00090     bool    isDecAh(RTL* r);
00091     bool    isSetX(Statement* e);
00092     bool    isAssignFromTern(Statement* s);
00093     void    bumpRegisterAll(Exp* e, int min, int max, int delta, int mask);
00094     unsigned fetch4(unsigned char* ptr);
00095 protected:
00096 
00097     virtual DecodeResult& decodeInstruction(ADDRESS pc);
00098     virtual void extraProcessCall(CallStatement *call, std::list<RTL*> *BB_rtls);
00099 };
00100 
00101 #endif

Generated on Tue Sep 19 21:18:29 2006 for Boomerang by  doxygen 1.4.6