From 3886c4a8f2e1bfe17cbf7a5a76ba0fc978c6bb48 Mon Sep 17 00:00:00 2001 From: Brandon Potter Date: Wed, 9 Nov 2016 14:27:40 -0600 Subject: syscall_emul: [patch 5/22] remove LiveProcess class and use Process instead The EIOProcess class was removed recently and it was the only other class which derived from Process. Since every Process invocation is also a LiveProcess invocation, it makes sense to simplify the organization by combining the fields from LiveProcess into Process. --- src/sim/process.hh | 44 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) (limited to 'src/sim/process.hh') diff --git a/src/sim/process.hh b/src/sim/process.hh index 87536830b..4b0428585 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -46,10 +46,10 @@ #include "sim/fd_entry.hh" #include "sim/sim_object.hh" -struct LiveProcessParams; struct ProcessParams; class EmulatedDriver; +class ObjectFile; class PageTableBase; class SyscallDesc; class SyscallReturn; @@ -170,9 +170,6 @@ class Process : public SimObject // Find a free context to use ThreadContext *findFreeContext(); - // provide program name for debug messages - virtual const char *progName() const { return ""; } - // generate new target fd for sim_fd int allocFD(int sim_fd, const std::string& filename, int flags, int mode, bool pipe); @@ -202,7 +199,6 @@ class Process : public SimObject // set the source of this read pipe for a checkpoint resume void setReadPipeSource(int read_pipe_fd, int source_fd); - virtual void syscall(int64_t callnum, ThreadContext *tc) = 0; void allocateMem(Addr vaddr, int64_t size, bool clobber = false); @@ -228,6 +224,15 @@ class Process : public SimObject void serialize(CheckpointOut &cp) const override; void unserialize(CheckpointIn &cp) override; + protected: + ObjectFile *objFile; + std::vector argv; + std::vector envp; + std::string cwd; + std::string executable; + + Process(ProcessParams *params, ObjectFile *obj_file); + public: // Id of the owner of the process uint64_t _uid; @@ -239,28 +244,9 @@ class Process : public SimObject uint64_t _pid; uint64_t _ppid; -}; - -// -// "Live" process with system calls redirected to host system -// -class ObjectFile; -class LiveProcess : public Process -{ - protected: - ObjectFile *objFile; - std::vector argv; - std::vector envp; - std::string cwd; - std::string executable; - - LiveProcess(LiveProcessParams *params, ObjectFile *objFile); - // Emulated drivers available to this process std::vector drivers; - public: - enum AuxiliaryVectorType { M5_AT_NULL = 0, M5_AT_IGNORE = 1, @@ -299,7 +285,7 @@ class LiveProcess : public Process inline uint64_t ppid() { return _ppid; } // provide program name for debug messages - virtual const char *progName() const { return executable.c_str(); } + const char *progName() const { return executable.c_str(); } std::string fullPath(const std::string &filename) @@ -317,7 +303,7 @@ class LiveProcess : public Process std::string getcwd() const { return cwd; } - virtual void syscall(int64_t callnum, ThreadContext *tc); + void syscall(int64_t callnum, ThreadContext *tc); virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i) = 0; virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width); @@ -345,12 +331,6 @@ class LiveProcess : public Process Addr getBias(); Addr getStartPC(); - - // this function is used to create the LiveProcess object, since - // we can't tell which subclass of LiveProcess to use until we - // open and look at the object file. - static LiveProcess *create(LiveProcessParams *params); }; - #endif // __PROCESS_HH__ -- cgit v1.2.3