クラス Onikiri::EmulationTraceSystem

#include <EmulationTraceSystem.h>

Onikiri::EmulationTraceSystemに対する継承グラフ

Inheritance graph
[凡例]
Onikiri::EmulationTraceSystemのコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

Public メソッド

void Run (SystemContext *context)

説明

EmulationTraceSystem.h42 行で定義されています。


関数

void EmulationTraceSystem::Run ( SystemContext *  context  ) 

EmulationTraceSystem.cpp43 行で定義されています。

参照先 Onikiri::Addr::addressOnikiri::g_envOnikiri::Environment::GetHostWorkPath()Onikiri::OpInfo::GetSrcNum()Onikiri::SimISAInfoDef::SimISAInfo_IW32_RW64_AS64::INSTRUCTION_WORD_BYTE_SIZEOnikiri::SimISAInfoDef::SimISAInfo_IW32_RW64_AS64::MAX_DST_REG_COUNTOnikiri::SimISAInfoDef::SimISAInfo_IW32_RW64_AS64::MAX_SRC_REG_COUNT.

参照元 Onikiri::SystemManager::RunEmulationTrace().

00044 {
00045     int processCount = context->emulator->GetProcessCount();
00046 
00047     vector<ofstream*> ofsList;
00048     ofsList.resize( processCount );
00049     for( int pid = 0; pid < processCount; pid++ ){
00050         String fileName = 
00051             g_env.GetHostWorkPath() + "./emulator." + lexical_cast<String>(pid) + ".log";
00052         ofsList[pid] = new ofstream( fileName );
00053     }
00054 
00055     // WX^
00056     ArchitectureStateList& archStateList = context->architectureStateList;
00057 
00058     s64 totalInsnCount = 0;
00059     vector<s64> insnCount;
00060     insnCount.resize( processCount, 0 );
00061 
00062     int curPID = 0;
00063     int terminateProcesses = 0;
00064     vector<u64> opID( processCount );
00065 
00066     while( totalInsnCount < context->executionInsns ){
00067 
00068         // Decide a thread executed in this iteration.
00069         PC& curThreadPC = archStateList[curPID].pc;
00070 
00071         if( curThreadPC.address == 0 ) {
00072             terminateProcesses++;
00073             if(terminateProcesses >= processCount){
00074                 break;
00075             }
00076             else{
00077                 continue;
00078             }
00079         }
00080 
00081         ofstream& ofs = *ofsList[curPID];
00082         EmulationOp op( context->emulator->GetMemImage() );
00083 
00084         // PC
00085         std::pair<OpInfo**, int> ops = 
00086             context->emulator->GetOp( curThreadPC );
00087         OpInfo** opInfoArray = ops.first;
00088         int opCount          = ops.second;
00089 
00090         // opInfoArray Sタs
00091         for(int opIndex = 0; opIndex < opCount; opIndex ++){
00092             OpInfo* opInfo = opInfoArray[opIndex];
00093             op.SetPC( curThreadPC );
00094             op.SetTakenPC( Addr(curThreadPC.pid, curThreadPC.tid, curThreadPC.address+4) );
00095             op.SetOpInfo(opInfo);
00096             op.SetTaken(false);
00097 
00098             // \[XIyh
00099             int srcCount = opInfo->GetSrcNum();
00100             for (int i = 0; i < srcCount; i ++) {
00101                 op.SetSrc(i, archStateList[curPID].registerValue[ opInfo->GetSrcOperand(i) ] );
00102             }
00103 
00104             context->emulator->Execute( &op, opInfo );
00105             context->emulator->Commit( &op, opInfo );
00106 
00107             // 
00108             int dstCount = opInfo->GetDstNum();
00109             for (int i = 0; i < dstCount; i ++) {
00110                 archStateList[curPID].registerValue[ opInfo->GetDstOperand(i) ] = op.GetDst(i);
00111             }
00112 
00113             // o
00114             ofs << "ID: " << opID[curPID] << "\tPC: " << curThreadPC.pid << "/" << hex << curThreadPC.address << dec << "[" << opIndex << "]\t";
00115             for (int i = 0; i < opInfo->GetDstNum(); ++i) {
00116                 ofs << "d" << i << ": " << opInfo->GetDstOperand(i) << "\t";
00117             }
00118             for (int i = opInfo->GetDstNum(); i < SimISAInfo::MAX_DST_REG_COUNT; ++i) {
00119                 ofs << "d" << i << ": -1" << "\t";
00120             }
00121 
00122             for (int i = 0; i < opInfo->GetSrcNum(); ++i) {
00123                 ofs << "s" << i << ": " << opInfo->GetSrcOperand(i) << "\t";
00124             }
00125             for (int i = opInfo->GetSrcNum(); i < SimISAInfo::MAX_SRC_REG_COUNT; ++i) {
00126                 ofs << "s" << i << ": -1" << "\t";
00127             }
00128 
00129             ofs << "TPC: " << op.GetTakenPC().pid << "/" << hex << op.GetTakenPC().address << dec << "(" << ( op.GetTaken() ? "t" : "n" ) << ")\t";
00130 
00131 
00132             for (int i = 0; i < opInfo->GetDstNum(); ++i) {
00133                 if( opInfo->GetDstOperand(i) != -1 ) {
00134                     ofs << "r" << opInfo->GetDstOperand(i) << "= " << hex << op.GetDst(i) << dec << "\t";
00135                 }else {
00136                     ofs << "r_= 0\t" ; 
00137                 }
00138             }
00139             for (int i = opInfo->GetDstNum(); i < SimISAInfo::MAX_DST_REG_COUNT; ++i) {
00140                 ofs << "r_= 0\t" ; 
00141             }
00142 
00143             for (int i = 0; i < opInfo->GetSrcNum(); ++i) {
00144                 if( opInfo->GetSrcOperand(i) != -1 ) {
00145                     ofs << "r" << opInfo->GetSrcOperand(i) << "= " << hex << op.GetSrc(i) << dec  << "\t";
00146                 }else {
00147                     ofs << "r_= 0\t" ; 
00148                 }
00149             }
00150             for (int i = opInfo->GetSrcNum(); i < SimISAInfo::MAX_SRC_REG_COUNT; ++i) {
00151                 ofs << "r_= 0\t" ; 
00152             }
00153 
00154             /*
00155             ofs << "Mem: " << hex << op.GetMemAccess().address.address << dec << "/"
00156             << op.GetMemAccess().size << "/"
00157             << (op.GetMemAccess().sign ? "s" : "u") << "/"
00158             << op.GetMemAccess().value;
00159             */
00160             ofs << endl;
00161             ++opID[curPID];
00162         }
00163 
00164         // PC
00165         if (op.GetTaken())
00166             curThreadPC = op.GetTakenPC();
00167         else
00168             curThreadPC.address += SimISAInfo::INSTRUCTION_WORD_BYTE_SIZE;
00169 
00170         totalInsnCount++;
00171         insnCount[ curPID ]++;
00172         curPID = (curPID + 1) % processCount;   // Round robin
00173     }
00174 
00175     for( int pid = 0; pid < processCount; pid++ ){
00176         ofsList[pid]->close();
00177         delete ofsList[pid];
00178     }
00179 
00180     context->executedInsns  = insnCount;
00181     context->executedCycles = 0;
00182 }

関数の呼び出しグラフ:

Here is the caller graph for this function:


このクラスの説明は次のファイルから生成されました:
Onikiri2に対してTue Jun 18 14:57:23 2013に生成されました。  doxygen 1.4.7