クラス Onikiri::SystemManager

#include <SystemManager.h>

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

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

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

Public 型

 PNT_ALLOCATE_MEMORY
 PNT_FREE_MEMORY
 PNT_READ_FILE_TO_MEMORY
 PNT_TERMINATION = 0
 PNT_WRITE_FILE_FROM_MEMORY
enum  PROCESS_NOTIFY_TYPE {
  PNT_TERMINATION = 0, PNT_READ_FILE_TO_MEMORY, PNT_WRITE_FILE_FROM_MEMORY, PNT_ALLOCATE_MEMORY,
  PNT_FREE_MEMORY
}

Public メソッド

virtual void Main ()
virtual void NotifyMemoryAllocation (const Addr &addr, u64 size, bool allocate)
virtual void NotifyProcessTermination (int pid)
virtual void NotifySyscallReadFileToMemory (const Addr &addr, u64 size)
virtual void NotifySyscallWriteFileFromMemory (const Addr &addr, u64 size)
 SystemManager ()
virtual ~SystemManager ()

Static Public 変数

static HookPoint< SystemManager,
ProcessNotifyParam
s_processNotifyHook

Protected 型

typedef SystemBase::SystemContext SystemContext

Protected メソッド

virtual void Finalize ()
virtual void GetInitialContext (ArchitectureStateList *archState)
virtual void Initialize ()
virtual void InitializeEmulator ()
virtual void InitializeResources ()
virtual void InitializeSimulationContext ()
virtual void NotifyChangingMode (PhysicalResourceNode::SimulationMode mode)
virtual void NotifyMemoryAllocationBody (ProcessNotifyParam *)
virtual void NotifyProcessTerminationBody (ProcessNotifyParam *)
virtual void NotifySyscallReadFileToMemoryBody (ProcessNotifyParam *)
virtual void NotifySyscallWriteFileFromMemoryBody (ProcessNotifyParam *)
virtual void Run ()
virtual void RunEmulation (SystemContext *context)
virtual void RunEmulationDebug (SystemContext *context)
virtual void RunEmulationTrace (SystemContext *context)
virtual void RunInorder (SystemContext *context)
virtual void RunSimulation (SystemContext *context)
virtual bool SetSimulationContext (const ArchitectureStateList &archState)
virtual void SetSystem (SystemIF *system)

Protected 変数

SystemContext m_context
s64 m_executedCycles
std::vector< s64m_executedInsns
ExtraOpDecoder m_extraOpDecoder
std::vector< double > m_ipc
std::vector< u64m_processMemoryUsage
s64 m_simulationCycles
s64 m_simulationInsns
s64 m_skipInsns
std::vector< s64m_skippedInsns
SystemIFm_system

構成

struct  ProcessNotifyParam

説明

SystemManager.h40 行で定義されています。


型定義

typedef SystemBase::SystemContext Onikiri::SystemManager::SystemContext [protected]

SystemManager.h100 行で定義されています。


列挙型

enum Onikiri::SystemManager::PROCESS_NOTIFY_TYPE

列挙型の値:
PNT_TERMINATION 
PNT_READ_FILE_TO_MEMORY 
PNT_WRITE_FILE_FROM_MEMORY 
PNT_ALLOCATE_MEMORY 
PNT_FREE_MEMORY 

SystemManager.h46 行で定義されています。

00047         {
00048             PNT_TERMINATION = 0,        // process termination
00049             PNT_READ_FILE_TO_MEMORY,    // read data from a file to memory
00050             PNT_WRITE_FILE_FROM_MEMORY, // write data from memory to a file
00051             PNT_ALLOCATE_MEMORY,        // allocate memory
00052             PNT_FREE_MEMORY,            // free memory
00053         };


コンストラクタとデストラクタ

SystemManager::SystemManager (  ) 

SystemManager.cpp62 行で定義されています。

参照先 m_simulationCyclesm_simulationInsnsm_skipInsnsm_system.

00063 {
00064     m_system = NULL;
00065     
00066     m_simulationCycles = 0;
00067     m_simulationInsns = 0;
00068     m_skipInsns = 0;
00069 }

SystemManager::~SystemManager (  )  [virtual]

SystemManager.cpp71 行で定義されています。

00072 {
00073 }


関数

void SystemManager::Finalize (  )  [protected, virtual]

SystemManager.cpp88 行で定義されています。

参照先 Onikiri::SystemBase::SystemContext::emulatorOnikiri::SystemBase::SystemContext::emulatorWrapperOnikiri::Dumper::Finalize()Onikiri::g_dumperm_contextOnikiri::ParamExchange::ReleaseParam()Onikiri::PhysicalResourceNode::ReleaseParam()Onikiri::SystemBase::SystemContext::resBuilder.

参照元 Main().

00089 {
00090     g_dumper.Finalize();
00091 
00092     m_context.emulatorWrapper.ReleaseParam();
00093     ReleaseParam();
00094 
00095     if( m_context.emulator ){
00096         delete m_context.emulator;
00097         m_context.emulator = NULL;
00098     }
00099     if( m_context.resBuilder ){
00100         delete m_context.resBuilder;
00101         m_context.resBuilder = NULL;
00102     }
00103 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::GetInitialContext ( ArchitectureStateList archState  )  [protected, virtual]

SystemManager.cpp185 行で定義されています。

参照先 Onikiri::SystemBase::SystemContext::emulatorOnikiri::EmulatorIF::GetEntryPoint()Onikiri::EmulatorIF::GetInitialRegValue()Onikiri::EmulatorIF::GetISAInfo()Onikiri::EmulatorIF::GetProcessCount()Onikiri::ISAInfoIF::GetRegisterCount()m_contextOnikiri::LogicalData::tid.

参照元 Initialize()InitializeSimulationContext().

00186 {
00187 
00188     int processCount = m_context.emulator->GetProcessCount();
00189     archStateList->resize( processCount );
00190     for( int pid = 0; pid < processCount; pid++ ){
00191         // PC
00192         PC pc = m_context.emulator->GetEntryPoint(pid);
00193         pc.tid = pid;   // The thread id from the GetEntryPoint() is not set in the emulator
00194         (*archStateList)[pid].pc = pc;
00195     }
00196 
00197     ISAInfoIF* isaInfo = m_context.emulator->GetISAInfo();
00198 
00199     // _WX^l emulator Zbg
00200     int logicalRegCount = isaInfo->GetRegisterCount();
00201     for( int pid = 0; pid < processCount; pid++ ){
00202         (*archStateList)[pid].registerValue.resize( logicalRegCount );
00203         for (int i = 0; i < logicalRegCount; i ++) {
00204             (*archStateList)[pid].registerValue[i] = m_context.emulator->GetInitialRegValue(pid, i);
00205         }
00206     }
00207 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::Initialize (  )  [protected, virtual]

SystemManager.cpp75 行で定義されています。

参照先 Onikiri::SystemBase::SystemContext::architectureStateListGetInitialContext()InitializeEmulator()InitializeResources()Onikiri::ParamExchange::LoadParam()m_contextOnikiri::SystemBase::SystemContext::resBuilder.

参照元 Main().

00076 {
00077     LoadParam();
00078 
00079     m_context.resBuilder = new ResourceBuilder();
00080 
00081     InitializeEmulator();
00082     InitializeResources();
00083     
00084     GetInitialContext( &m_context.architectureStateList );
00085 
00086 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::InitializeEmulator (  )  [protected, virtual]

SystemManager.cpp105 行で定義されています。

参照先 Onikiri::EmulatorFactory::Create()Onikiri::SystemBase::SystemContext::emulatorOnikiri::g_envOnikiri::g_paramDBOnikiri::ParamDB::Get()Onikiri::EmulatorIF::GetISAInfo()m_contextm_extraOpDecoderOnikiri::Environment::PrintInternal()Onikiri::EmulatorIF::SetExtraOpDecoder()Onikiri::SystemBase::SystemContext::targetArchitectureOnikiri::SimISAInfoDef::SimISAInfo_IW32_RW64_AS64::TestISAInfo()THROW_RUNTIME_ERROR.

参照元 Initialize().

00106 {
00107     g_env.PrintInternal("Emulator ... ");
00108 
00109     int processConfigCount = 0;
00110     if( !g_paramDB.Get( "/Session/Emulator/Processes/#Process", &processConfigCount, false ) ){
00111         THROW_RUNTIME_ERROR(
00112             "'/Session/Emulator/Processes/Process' node is not found. "
00113             "There is no process configuration. "
00114             "This may occur when no configuration XML file is passed. "
00115             "Please check your command line option."
00116         );
00117     }
00118 
00119     // Set the emulator
00120     EmulatorFactory emulatorFactory;
00121     m_context.emulator = emulatorFactory.Create( m_context.targetArchitecture, this );
00122     m_context.emulator->SetExtraOpDecoder( &m_extraOpDecoder );
00123     SimISAInfo::TestISAInfo( m_context.emulator->GetISAInfo() );
00124 
00125     g_env.PrintInternal("initialized.\n");
00126 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::InitializeResources (  )  [protected, virtual]

SystemManager.cpp128 行で定義されています。

参照先 Onikiri::SystemBase::SystemContext::cachesOnikiri::ResourceBuilder::Construct()Onikiri::SystemBase::SystemContext::coresOnikiri::ResourceBuilder::ResNode::countOnikiri::SystemBase::SystemContext::emulatorOnikiri::SystemBase::SystemContext::emulatorWrapperOnikiri::ResourceBuilder::ResNode::externalOnikiri::SystemBase::SystemContext::forwardEmulatorOnikiri::g_dumperOnikiri::g_envOnikiri::ResourceBuilder::GetResourceByType()Onikiri::SystemBase::SystemContext::globalClockOnikiri::Dumper::Initialize()InitializeSimulationContext()Onikiri::ResourceBuilder::ResNode::instancesm_contextOnikiri::ResourceBuilder::ResNode::nameOnikiri::PhysicalResourceNodeInfo::nameOnikiri::ResourceBuilder::ResNode::paramPathOnikiri::PhysicalResourceNodeInfo::paramPathOnikiri::Environment::PrintInternal()Onikiri::SystemBase::SystemContext::resBuilderOnikiri::ResourceBuilder::ResNode::resultPathOnikiri::PhysicalResourceNodeInfo::resultPathOnikiri::PhysicalResourceNodeInfo::resultRootPathOnikiri::EmulatorWrapper::SetEmulator()Onikiri::ResourceBuilder::SetExternalResource()Onikiri::PhysicalResourceNode::SetInfo()Onikiri::SystemBase::SystemContext::threadsOnikiri::ResourceBuilder::ResNode::typeOnikiri::PhysicalResourceNodeInfo::typeName.

参照元 Initialize().

00129 {
00130     g_env.PrintInternal("Resources ... ");
00131 
00132     // Set the external emulator to the resource builder before constructing and connecting.
00133     PhysicalResourceNodeInfo info;
00134     info.name       = "emulator";
00135     info.typeName   = "EmulatorIF";
00136     info.paramPath  = "/Session/Emulator/";
00137     info.resultPath = "/Session/Result/Resource/Emulator/";
00138     info.resultRootPath = "/Session/Result/Resource/Emulator/";
00139     m_context.emulatorWrapper.SetInfo( info );
00140     m_context.emulatorWrapper.SetEmulator( m_context.emulator ); 
00141 
00142     ResourceBuilder::ResNode node;
00143     node.count = 1;
00144     node.external = true;
00145     node.instances.push_back( &m_context.emulatorWrapper );
00146     node.name = info.name;
00147     node.type = info.typeName;
00148     node.paramPath = info.paramPath;
00149     node.resultPath = info.resultPath;
00150     m_context.resBuilder->SetExternalResource( &node );
00151 
00152     // Construct objects
00153     m_context.resBuilder->Construct();
00154 
00155     m_context.resBuilder->GetResourceByType( "Core",   m_context.cores );
00156     m_context.resBuilder->GetResourceByType( "Thread", m_context.threads );
00157     m_context.resBuilder->GetResourceByType( "Cache",  m_context.caches );
00158     m_context.resBuilder->GetResourceByType( "GlobalClock", m_context.globalClock );
00159     m_context.resBuilder->GetResourceByType( "ForwardEmulator", m_context.forwardEmulator );
00160 
00161     InitializeSimulationContext();
00162 
00163     g_dumper.Initialize( m_context.cores, m_context.threads );
00164 
00165     g_env.PrintInternal("initialized.\n");
00166 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::InitializeSimulationContext (  )  [protected, virtual]

SystemManager.cpp168 行で定義されています。

参照先 Onikiri::SystemBase::SystemContext::emulatorGetInitialContext()Onikiri::EmulatorIF::GetProcessCount()m_contextSetSimulationContext()Onikiri::SystemBase::SystemContext::threadsTHROW_RUNTIME_ERROR.

参照元 InitializeResources().

00169 {
00170     int processCount = m_context.emulator->GetProcessCount();
00171     if( processCount > m_context.threads.GetSize() ){
00172         THROW_RUNTIME_ERROR(
00173             "The number of the processes is greater than the number of the threads." 
00174         );
00175     }
00176 
00177     // Get initial contexts
00178     ArchitectureStateList archStateList;
00179     GetInitialContext( &archStateList );
00180 
00181     // Set the initial contexts
00182     SetSimulationContext( archStateList );
00183 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::Main (  )  [virtual]

SystemManager.cpp309 行で定義されています。

参照先 Finalize()Initialize()Run().

参照元 main().

00310 {
00311     bool initialized = false;
00312     bool thrown = false;
00313     std::string errMessage;
00314 
00315     // Initialize the system.
00316     try{
00317         Initialize();
00318         initialized = true;
00319     }
00320     catch( const std::exception& error ){
00321         errMessage = error.what();
00322         thrown = true;
00323     }
00324 
00325     // Run
00326     try{
00327         if( initialized ){
00328             Run();
00329         }
00330     }
00331     catch( const std::exception& error ){
00332         if( !thrown ){
00333             errMessage = error.what();
00334         }
00335         thrown = true;
00336     }
00337 
00338     // Finalize the system.
00339     try{
00340         Finalize();
00341     }
00342     catch( const std::exception& error ){
00343         if( !thrown ){
00344             errMessage = error.what();
00345         }
00346         thrown = true;
00347     }
00348 
00349     if( thrown ){
00350         throw std::runtime_error( errMessage.c_str() );
00351     }
00352 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::NotifyChangingMode ( PhysicalResourceNode::SimulationMode  mode  )  [protected, virtual]

SystemManager.cpp560 行で定義されています。

参照先 ASSERTOnikiri::ResourceBuilder::GetAllResources()m_contextOnikiri::SystemBase::SystemContext::resBuilder.

参照元 RunEmulation()RunEmulationTrace()RunInorder()RunSimulation().

00561 {
00562     ASSERT( m_context.resBuilder != NULL );
00563     std::vector<PhysicalResourceNode*> res =
00564         m_context.resBuilder->GetAllResources();
00565     for( size_t i = 0; i < res.size(); i++ ){
00566         res[i]->ChangeSimulationMode( mode );
00567     }
00568 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::NotifyMemoryAllocation ( const Addr addr,
u64  size,
bool  allocate 
) [virtual]

Onikiri::SystemIFを実装しています。

SystemManager.cpp492 行で定義されています。

参照先 Onikiri::HookEntry()m_processMemoryUsageNotifyMemoryAllocationBody()Onikiri::LogicalData::pidPNT_ALLOCATE_MEMORYPNT_FREE_MEMORYs_processNotifyHook.

00493 {
00494     // Update process memory usage
00495     if( m_processMemoryUsage.size() <= (size_t)addr.pid ){
00496         m_processMemoryUsage.resize( addr.pid + 1 );
00497     }
00498     if( allocate ){
00499         m_processMemoryUsage[addr.pid] += size;
00500     }
00501     else{
00502         m_processMemoryUsage[addr.pid] -= size;
00503     }
00504 
00505     ProcessNotifyParam param = 
00506     {
00507         allocate ? PNT_ALLOCATE_MEMORY : PNT_FREE_MEMORY, 
00508         addr.pid, 
00509         addr, 
00510         size,
00511         m_processMemoryUsage[addr.pid]
00512     };
00513     HookEntry(
00514         this,
00515         &SystemManager::NotifyMemoryAllocationBody,
00516         &s_processNotifyHook,
00517         &param 
00518     );
00519 }

関数の呼び出しグラフ:

void SystemManager::NotifyMemoryAllocationBody ( ProcessNotifyParam  )  [protected, virtual]

SystemManager.cpp548 行で定義されています。

参照先 Onikiri::SystemManager::ProcessNotifyParam::addrm_systemOnikiri::SystemIF::NotifyMemoryAllocation()PNT_ALLOCATE_MEMORYOnikiri::SystemManager::ProcessNotifyParam::sizeOnikiri::SystemManager::ProcessNotifyParam::type.

参照元 NotifyMemoryAllocation().

00549 {
00550     if(!m_system)
00551         return;
00552 
00553     m_system->NotifyMemoryAllocation( 
00554         param->addr,
00555         param->size, 
00556         param->type == PNT_ALLOCATE_MEMORY ? true : false 
00557     );
00558 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::NotifyProcessTermination ( int  pid  )  [virtual]

Onikiri::SystemIFを実装しています。

SystemManager.cpp453 行で定義されています。

参照先 Onikiri::HookEntry()NotifyProcessTerminationBody()PNT_TERMINATIONs_processNotifyHook.

00454 {   
00455     ProcessNotifyParam param = { PNT_TERMINATION, pid, Addr(), 0/*size*/, 0/*totalSize*/ };
00456     HookEntry(
00457         this,
00458         &SystemManager::NotifyProcessTerminationBody,
00459         &s_processNotifyHook,
00460         &param 
00461     );
00462 }

関数の呼び出しグラフ:

void SystemManager::NotifyProcessTerminationBody ( ProcessNotifyParam  )  [protected, virtual]

SystemManager.cpp524 行で定義されています。

参照先 m_systemOnikiri::SystemIF::NotifyProcessTermination()Onikiri::SystemManager::ProcessNotifyParam::pid.

参照元 NotifyProcessTermination().

00525 {
00526     if(!m_system)
00527         return;
00528 
00529     m_system->NotifyProcessTermination( param->pid );
00530 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::NotifySyscallReadFileToMemory ( const Addr addr,
u64  size 
) [virtual]

Onikiri::SystemIFを実装しています。

SystemManager.cpp464 行で定義されています。

参照先 Onikiri::HookEntry()NotifySyscallReadFileToMemoryBody()Onikiri::LogicalData::pidPNT_READ_FILE_TO_MEMORYs_processNotifyHook.

00465 {
00466     ProcessNotifyParam param = 
00467     {
00468         PNT_READ_FILE_TO_MEMORY, addr.pid, addr, size, 0 
00469     };
00470     HookEntry(
00471         this,
00472         &SystemManager::NotifySyscallReadFileToMemoryBody,
00473         &s_processNotifyHook,
00474         &param 
00475     );
00476 }

関数の呼び出しグラフ:

void SystemManager::NotifySyscallReadFileToMemoryBody ( ProcessNotifyParam  )  [protected, virtual]

SystemManager.cpp532 行で定義されています。

参照先 Onikiri::SystemManager::ProcessNotifyParam::addrm_systemOnikiri::SystemIF::NotifySyscallReadFileToMemory()Onikiri::SystemManager::ProcessNotifyParam::size.

参照元 NotifySyscallReadFileToMemory().

00533 {
00534     if(!m_system)
00535         return;
00536 
00537     m_system->NotifySyscallReadFileToMemory( param->addr, param->size );
00538 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::NotifySyscallWriteFileFromMemory ( const Addr addr,
u64  size 
) [virtual]

Onikiri::SystemIFを実装しています。

SystemManager.cpp478 行で定義されています。

参照先 Onikiri::HookEntry()NotifySyscallWriteFileFromMemoryBody()Onikiri::LogicalData::pidPNT_WRITE_FILE_FROM_MEMORYs_processNotifyHook.

00479 {
00480     ProcessNotifyParam param = 
00481     {
00482         PNT_WRITE_FILE_FROM_MEMORY, addr.pid, addr, size, 0
00483     };
00484     HookEntry(
00485         this,
00486         &SystemManager::NotifySyscallWriteFileFromMemoryBody,
00487         &s_processNotifyHook,
00488         &param 
00489     );
00490 }

関数の呼び出しグラフ:

void SystemManager::NotifySyscallWriteFileFromMemoryBody ( ProcessNotifyParam  )  [protected, virtual]

SystemManager.cpp540 行で定義されています。

参照先 Onikiri::SystemManager::ProcessNotifyParam::addrm_systemOnikiri::SystemIF::NotifySyscallWriteFileFromMemory()Onikiri::SystemManager::ProcessNotifyParam::size.

参照元 NotifySyscallWriteFileFromMemory().

00541 {
00542     if(!m_system)
00543         return;
00544 
00545     m_system->NotifySyscallWriteFileFromMemory( param->addr, param->size );
00546 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::Run (  )  [protected, virtual]

SystemManager.cpp354 行で定義されています。

参照先 Onikiri::SystemBase::SystemContext::architectureStateListOnikiri::SystemBase::SystemContext::executedCyclesOnikiri::SystemBase::SystemContext::executedInsnsOnikiri::SystemBase::SystemContext::executionCyclesOnikiri::SystemBase::SystemContext::executionInsnsm_contextm_executedCyclesm_executedInsnsm_ipcm_simulationCyclesm_simulationInsnsm_skipInsnsm_skippedInsnsOnikiri::SystemBase::SystemContext::modeRunEmulation()RunEmulationDebug()RunEmulationTrace()RunInorder()RunSimulation()RUNTIME_WARNINGSetSimulationContext()THROW_RUNTIME_ERROR.

参照元 Main().

00355 {
00356     const String& mode = m_context.mode;
00357 
00358     m_context.executionInsns  = m_simulationInsns;
00359     m_context.executionCycles = m_simulationCycles;
00360 
00361     if( mode == "Emulation" ){
00362         if( m_context.executionInsns == 0 ){
00363             RUNTIME_WARNING( "'@SimulationInsns' is 0 and nothing is executed in 'Emulation' mode." );
00364         }
00365         RunEmulation( &m_context );
00366     }
00367     else if( mode == "CreateEmulationTrace" ){
00368         if( m_context.executionInsns == 0 ){
00369             RUNTIME_WARNING( "'@SimulationInsns' is 0 and nothing is executed in 'CreateEmulationTrace' mode." );
00370         }
00371         RunEmulationTrace( &m_context );
00372     }
00373     else if( mode == "EmulationWithDebug" ){
00374         if( m_context.executionInsns == 0 ){
00375             RUNTIME_WARNING( "'@SimulationInsns' is 0 and nothing is executed in 'CreateEmulationTrace' mode." );
00376         }
00377         RunEmulationDebug( &m_context );
00378     }
00379     else if( mode == "Inorder" ) {
00380         // Run emulation
00381         m_context.executionInsns  = m_skipInsns;
00382         m_context.executionCycles = 0;
00383         RunEmulation( &m_context );
00384         m_skippedInsns = m_context.executedInsns;
00385 
00386         // Run inorder
00387         m_context.executionInsns  = m_simulationInsns;
00388         m_context.executionCycles = m_simulationCycles;
00389         m_context.executedInsns.clear();
00390         m_context.executedCycles = 0;
00391         if( SetSimulationContext( m_context.architectureStateList ) ){
00392             RunInorder( &m_context );
00393         }
00394     }
00395     else if( mode == "SkipByInorder" ) {
00396         // Run inorder
00397         m_context.executionInsns  = m_skipInsns;
00398         m_context.executionCycles = 0;
00399         RunInorder( &m_context );
00400         m_skippedInsns = m_context.executedInsns;
00401 
00402         // Run simulation
00403         m_context.executionInsns  = m_simulationInsns;
00404         m_context.executionCycles = m_simulationCycles;
00405         m_context.executedInsns.clear();
00406         m_context.executedCycles = 0;
00407         if( SetSimulationContext( m_context.architectureStateList ) ){
00408             RunSimulation( &m_context );
00409         }
00410     }
00411     else if( mode == "Simulation" ){
00412 
00413         // Run emulation
00414         m_context.executionInsns  = m_skipInsns;
00415         m_context.executionCycles = 0;
00416         RunEmulation( &m_context );
00417         m_skippedInsns = m_context.executedInsns;
00418 
00419         // Run simulation
00420         m_context.executionInsns  = m_simulationInsns;
00421         m_context.executionCycles = m_simulationCycles;
00422         m_context.executedInsns.clear();
00423         m_context.executedCycles = 0;
00424         if( SetSimulationContext( m_context.architectureStateList ) ){
00425             RunSimulation( &m_context );
00426         }
00427     }
00428     else{
00429         THROW_RUNTIME_ERROR(
00430             "An unknown simulation mode is specified in the"
00431             "'/Session/System/@Mode'\n"
00432             "This parameter must be one of the following strings : \n"
00433             "[Emulation, Simulation, Inorder, CreateEmulationTrace, SkipByInorder]"
00434         );
00435     }
00436 
00437     m_executedInsns  = m_context.executedInsns;
00438     m_executedCycles = m_context.executedCycles;
00439     m_ipc.clear();
00440     for( size_t i = 0; i < m_executedInsns.size(); ++i ){
00441         if( m_executedCycles != 0 ){
00442             m_ipc.push_back( (double)m_executedInsns[i] / (double)m_executedCycles );
00443         }
00444         else{
00445             m_ipc.push_back( 1.0 );
00446         }
00447     }
00448 
00449 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::RunEmulation ( SystemContext context  )  [protected, virtual]

SystemManager.cpp277 行で定義されています。

参照先 NotifyChangingMode()Onikiri::EmulationSystem::Run()Onikiri::PhysicalResourceNode::SM_EMULATION.

参照元 Run().

00278 {
00279     NotifyChangingMode( PhysicalResourceNode::SM_EMULATION );
00280     EmulationSystem emulationSystem;
00281     emulationSystem.Run( context );
00282 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::RunEmulationDebug ( SystemContext context  )  [protected, virtual]

SystemManager.cpp291 行で定義されています。

参照先 Onikiri::EmulationDebugSystem::Run().

参照元 Run().

00292 {
00293     EmulationDebugSystem emulationDebugSystem;
00294     emulationDebugSystem.Run( context );
00295 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::RunEmulationTrace ( SystemContext context  )  [protected, virtual]

SystemManager.cpp284 行で定義されています。

参照先 NotifyChangingMode()Onikiri::EmulationTraceSystem::Run()Onikiri::PhysicalResourceNode::SM_EMULATION.

参照元 Run().

00285 {
00286     NotifyChangingMode( PhysicalResourceNode::SM_EMULATION );
00287     EmulationTraceSystem emulationTraceSystem;
00288     emulationTraceSystem.Run( context );
00289 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::RunInorder ( SystemContext context  )  [protected, virtual]

SystemManager.cpp297 行で定義されています。

参照先 NotifyChangingMode()Onikiri::InorderSystem::Run()Onikiri::PhysicalResourceNode::SM_INORDER.

参照元 Run().

00298 {
00299     NotifyChangingMode( PhysicalResourceNode::SM_INORDER );
00300     InorderSystem inorderSystem;
00301     inorderSystem.Run( context );
00302 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::RunSimulation ( SystemContext context  )  [protected, virtual]

SystemManager.cpp270 行で定義されています。

参照先 NotifyChangingMode()Onikiri::SimulationSystem::Run()Onikiri::PhysicalResourceNode::SM_SIMULATION.

参照元 Run().

00271 {
00272     NotifyChangingMode( PhysicalResourceNode::SM_SIMULATION );
00273     SimulationSystem simulationSystem;
00274     simulationSystem.Run( context );
00275 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

bool SystemManager::SetSimulationContext ( const ArchitectureStateList archState  )  [protected, virtual]

SystemManager.cpp209 行で定義されています。

参照先 Onikiri::SystemBase::SystemContext::coresOnikiri::SystemBase::SystemContext::emulatorOnikiri::SystemBase::SystemContext::executionInsnsOnikiri::EmulatorIF::GetISAInfo()Onikiri::RegisterFile::GetPhyReg()Onikiri::EmulatorIF::GetProcessCount()Onikiri::ISAInfoIF::GetRegisterCount()Onikiri::RegisterFile::GetTotalCapacity()m_contextOnikiri::RegDepPredIF::PeekReg()Onikiri::Dependency::Set()Onikiri::PhyReg::SetVal()Onikiri::SystemBase::SystemContext::threads.

参照元 InitializeSimulationContext()Run().

00210 {
00211     ISAInfoIF* isaInfo  = m_context.emulator->GetISAInfo();
00212     int processCount    = m_context.emulator->GetProcessCount();
00213     int logicalRegCount = isaInfo->GetRegisterCount();
00214 
00215     for( int i = 0; i < m_context.cores.GetSize(); i++ ){
00216         Core* core = m_context.cores[i];
00217 
00218         // fetch index
00219         core->GetFetcher()->SetInitialNumFetchedOp(0);
00220         // retire count
00221         core->GetRetirer()->SetInitialNumRetiredOp(0, 0, m_context.executionInsns );
00222 
00223         // register readiness
00224         RegisterFile* regFile = core->GetRegisterFile();
00225         for(int i = 0; i < regFile->GetTotalCapacity(); ++i) {
00226             PhyReg* reg = regFile->GetPhyReg(i);
00227             reg->Set();
00228         }
00229     }
00230 
00231     bool remainingProcess = false;
00232     for( int pid = 0; pid < processCount; pid++ ){
00233         const ArchitectureState& context = archStateList[pid];
00234         if( context.pc.address != 0 ){
00235             remainingProcess = true;
00236 
00237             // fetch pc
00238             PC pc = context.pc;
00239             pc.tid = pid;   // A thread id is not set in the emulator
00240             m_context.threads[pid]->InitializeContext( pc );
00241             m_context.threads[pid]->Activate( true );
00242 
00243             RegDepPredIF* regDepPred = m_context.threads[pid]->GetRegDepPred();
00244             RegisterFile* regFile    = m_context.threads[pid]->GetCore()->GetRegisterFile();
00245 
00246             // register value
00247             for(int i = 0; i < logicalRegCount; ++i) {
00248                 int phyRegNo = regDepPred->PeekReg(i);
00249                 PhyReg* reg  = regFile->GetPhyReg( phyRegNo );
00250                 reg->SetVal( context.registerValue[i] );
00251             }
00252         }
00253         else{
00254             // Deactivate the process
00255             m_context.threads[pid]->Activate( false );
00256         }
00257     }
00258 
00259     // Threads that exceed the number of the processes are deactivated.
00260     for( int i = processCount; i < m_context.threads.GetSize(); i++ ){
00261         PC entryPoint( PID_INVALID, i, 0 );
00262         m_context.threads[i]->InitializeContext(    entryPoint );
00263         m_context.threads[i]->Activate( false );
00264     }
00265 
00266     m_context.forwardEmulator->SetContext( archStateList );
00267     return remainingProcess;
00268 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SystemManager::SetSystem ( SystemIF system  )  [protected, virtual]

Onikiri::SystemManagerIFを実装しています。

SystemManager.cpp304 行で定義されています。

参照先 m_system.

00305 {
00306     m_system = system;
00307 }


変数

SystemContext Onikiri::SystemManager::m_context [protected]

SystemManager.h102 行で定義されています。

参照元 Finalize()GetInitialContext()Initialize()InitializeEmulator()InitializeResources()InitializeSimulationContext()NotifyChangingMode()Run()SetSimulationContext().

s64 Onikiri::SystemManager::m_executedCycles [protected]

SystemManager.h106 行で定義されています。

参照元 Run().

std::vector<s64> Onikiri::SystemManager::m_executedInsns [protected]

SystemManager.h111 行で定義されています。

参照元 Run().

ExtraOpDecoder Onikiri::SystemManager::m_extraOpDecoder [protected]

SystemManager.h116 行で定義されています。

参照元 InitializeEmulator().

std::vector<double> Onikiri::SystemManager::m_ipc [protected]

SystemManager.h114 行で定義されています。

参照元 Run().

std::vector<u64> Onikiri::SystemManager::m_processMemoryUsage [protected]

SystemManager.h115 行で定義されています。

参照元 NotifyMemoryAllocation().

s64 Onikiri::SystemManager::m_simulationCycles [protected]

SystemManager.h105 行で定義されています。

参照元 Run()SystemManager().

s64 Onikiri::SystemManager::m_simulationInsns [protected]

SystemManager.h108 行で定義されています。

参照元 Run()SystemManager().

s64 Onikiri::SystemManager::m_skipInsns [protected]

SystemManager.h109 行で定義されています。

参照元 Run()SystemManager().

std::vector<s64> Onikiri::SystemManager::m_skippedInsns [protected]

SystemManager.h112 行で定義されています。

参照元 Run().

SystemIF* Onikiri::SystemManager::m_system [protected]

SystemManager.h103 行で定義されています。

参照元 NotifyMemoryAllocationBody()NotifyProcessTerminationBody()NotifySyscallReadFileToMemoryBody()NotifySyscallWriteFileFromMemoryBody()SetSystem()SystemManager().

HookPoint< SystemManager, SystemManager::ProcessNotifyParam > Onikiri::SystemManager::s_processNotifyHook [static]

SystemManager.h63 行で定義されています。

参照元 NotifyMemoryAllocation()NotifyProcessTermination()NotifySyscallReadFileToMemory()NotifySyscallWriteFileFromMemory().


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