src/Emu/Utility/System/ProcessState.h

説明を見る。
00001 // 
00002 // Copyright (c) 2005-2008 Kenichi Watanabe.
00003 // Copyright (c) 2005-2008 Yasuhiro Watari.
00004 // Copyright (c) 2005-2008 Hironori Ichibayashi.
00005 // Copyright (c) 2008-2009 Kazuo Horio.
00006 // Copyright (c) 2009-2013 Naruki Kurata.
00007 // Copyright (c) 2005-2013 Ryota Shioya.
00008 // Copyright (c) 2005-2013 Masahiro Goshima.
00009 // 
00010 // This software is provided 'as-is', without any express or implied
00011 // warranty. In no event will the authors be held liable for any damages
00012 // arising from the use of this software.
00013 // 
00014 // Permission is granted to anyone to use this software for any purpose,
00015 // including commercial applications, and to alter it and redistribute it
00016 // freely, subject to the following restrictions:
00017 // 
00018 // 1. The origin of this software must not be misrepresented; you must not
00019 // claim that you wrote the original software. If you use this software
00020 // in a product, an acknowledgment in the product documentation would be
00021 // appreciated but is not required.
00022 // 
00023 // 2. Altered source versions must be plainly marked as such, and must not be
00024 // misrepresented as being the original software.
00025 // 
00026 // 3. This notice may not be removed or altered from any source
00027 // distribution.
00028 // 
00029 // 
00030 
00031 
00032 #ifndef __EMULATORUTILITY_PROCESSINFO_H__
00033 #define __EMULATORUTILITY_PROCESSINFO_H__
00034 
00035 #include <boost/pool/pool.hpp>
00036 
00037 #include "Interface/EmulatorIF.h"
00038 #include "Interface/OpStateIF.h"
00039 #include "Env/Param/ParamExchange.h"
00040 
00041 namespace Onikiri {
00042     class SystemIF;
00043 
00044     namespace EmulatorUtility {
00045 
00046         class VirtualSystem;
00047         class MemorySystem;
00048         class LoaderIF;
00049         class SyscallConvIF;
00050 
00051         // Emulator/Processes/Process oNX
00052         class ProcessCreateParam : public ParamExchange
00053         {
00054         public:
00055             explicit ProcessCreateParam(int processNumber);
00056             ~ProcessCreateParam();
00057 
00058             const String  GetTargetBasePath() const;
00059             const String& GetTargetWorkPath() const { return m_targetWorkPath; }
00060             const String& GetCommand() const { return m_command; }
00061             const String& GetCommandArguments() const { return m_commandArguments; }
00062             const String& GetStdinFilename() const { return m_stdinFilename; }
00063             const String& GetStdinFileOpenMode() const { return m_stdinFileOpenMode; }
00064             const String& GetStdoutFilename() const { return m_stdoutFilename; }
00065             const String& GetStderrFilename() const { return m_stderrFilename; }
00066             const u64 GetStackMegaBytes() const { return m_stackMegaBytes; }
00067         private:
00068             // param_map
00069             int m_processNumber;
00070             String m_targetBasePath;
00071             String m_targetWorkPath;
00072             String m_command;
00073             String m_commandArguments;
00074             String m_stdinFilename;
00075             String m_stdinFileOpenMode;
00076             String m_stdoutFilename;
00077             String m_stderrFilename;
00078             u64 m_stackMegaBytes;
00079 
00080         public:
00081             BEGIN_PARAM_MAP_INDEX("/Session/Emulator/Processes/Process", m_processNumber)
00082                 PARAM_ENTRY("@TargetBasePath", m_targetBasePath)
00083                 PARAM_ENTRY("@TargetWorkPath", m_targetWorkPath)
00084                 PARAM_ENTRY("@Command", m_command)
00085                 PARAM_ENTRY("@CommandArguments", m_commandArguments)
00086                 PARAM_ENTRY("@STDIN", m_stdinFilename)
00087                 PARAM_ENTRY("@STDINFileOpenMode", m_stdinFileOpenMode)
00088                 PARAM_ENTRY("@STDOUT", m_stdoutFilename)
00089                 PARAM_ENTRY("@STDERR", m_stderrFilename)
00090                 PARAM_ENTRY("@StackMegaBytes", m_stackMegaBytes)
00091             END_PARAM_MAP()
00092         };
00093 
00094         // vZX (EAhXEEVXeR[) 
00095         class ProcessState
00096         {
00097         public:
00098             ProcessState(int pid);
00099             ~ProcessState();
00100 
00101             template<class Traits>
00102             void Init(const ProcessCreateParam& createParam, SystemIF* simSystem) 
00103             {
00104                 Init(
00105                     createParam, 
00106                     simSystem, 
00107                     new typename Traits::SyscallConvType(this), 
00108                     new typename Traits::LoaderType(), 
00109                     Traits::IsBigEndian
00110                 );
00111             }
00112 
00113             // Gg[|Cg
00114             u64 GetEntryPoint() const;
00115             // WX^l
00116             u64 GetInitialRegValue(int index) const;
00117 
00118             int GetPID() const { return m_pid; }
00119 
00120             // R[h (JnAhXCoCg) (EmulatorKp)
00121             std::pair<u64, size_t> GetCodeRange() const { return m_codeRange; }
00122 
00123             SyscallConvIF* GetSyscallConv() { return m_syscallConv; }
00124             MemorySystem* GetMemorySystem() { return m_memorySystem; }
00125             VirtualSystem* GetVirtualSystem() { return m_virtualSystem; }
00126 
00127             // XbhLl
00128             void SetThreadUniqueValue(u64 value);
00129             u64 GetThreadUniqueValue();
00130 
00131         private:
00132             void Init(const ProcessCreateParam& pcp, SystemIF* simSystem, SyscallConvIF* syscallConv, LoaderIF* loader, bool bigEndian);
00133             void InitStack(const ProcessCreateParam& createParam);
00134             void InitTargetStdIO(const ProcessCreateParam& createParam);
00135 
00136             int m_pid;
00137             std::pair<u64, size_t> m_codeRange;
00138             VirtualSystem* m_virtualSystem;
00139             MemorySystem* m_memorySystem;
00140             LoaderIF* m_loader;
00141             SyscallConvIF* m_syscallConv;
00142 
00143             // fXgNgゥt@C
00144             std::vector<FILE*> m_autoCloseFile;
00145             
00146             // rduniq, wruniq ANZXXbhLl
00147             u64 m_threadUniqueValue;
00148         };
00149 
00150     } // namespace EmulatorUtility
00151 } // namespace Onikiri
00152 
00153 #endif

Onikiri2に対してTue Jun 18 14:34:20 2013に生成されました。  doxygen 1.4.7