00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PPCLOADER_H_
00016 #define PPCLOADER_H_
00017
00018 #include "ppcFront.h"
00019
00020 #include "mach-o/loader.h"
00021
00022
00023
00024
00025
00026
00027 class ppcLoader
00028 {
00029 static char* copyBuf;
00030 static uint bufSize;
00031 static FILE *lle;
00032 static int execFD;
00033 static bool CopyToTEXT(simAddress dest, void* source, int Bytes);
00034 static bool loadUnixThread(const mach_header *mh,
00035 const thread_command* lcs,
00036 const vector<ppcThread*> &p);
00037 static bool performLoadCommands(const mach_header *Mh,
00038 const load_command *lcs,
00039 const vector<ppcThread*> &p,
00040 const bool subset);
00041 static bool loadSegment(const mach_header *mh,
00042 const segment_command *lcs,
00043 const vector<ppcThread*> &p,
00044 const bool subset);
00045 static bool loadSections(const mach_header *mh,
00046 const segment_command *lcs,
00047 bool isExec,
00048 const bool subset);
00049 static bool getHeader(simAddress*, simRegister[32]);
00050 static bool readRegion();
00051 static bool initLLEThreads(const simAddress, const simRegister[32],
00052 const vector<ppcThread*> &p);
00053 public:
00054
00055 static simAddress constrLoc;
00056
00057 static simAddress constrSize;
00058
00059 static vector<processor*> *subProc;
00060
00061 static vector<simPID> *subPID;
00062
00063 static processor *theProc;
00064 static bool LoadFromDevice(int fd,
00065 const vector<ppcThread*> &p,
00066 processor *proc,
00067 char **argv = NULL,
00068 char **argp = NULL,
00069 bool subset=0);
00070 static bool LoadFromDevice(const char *Filename,
00071 const vector<ppcThread*> &p,
00072 processor *proc,
00073 char **argv = NULL,
00074 char **argp = NULL,
00075 bool subset=0);
00076 static bool LoadLLE(const char *Filename,
00077 const vector<ppcThread*> &p,
00078 char **argv = NULL,
00079 char **argp = NULL);
00080 };
00081
00082 #endif
00083