#include <string>
#include <vector>
+#include "sim/byteswap.hh"
#include "sim/process.hh"
class ObjectFile;
{
protected:
+ const Addr StackBias;
+
//The locations of the fill and spill handlers
Addr fillStart, spillStart;
- SparcLiveProcess(const std::string &nm, ObjectFile *objFile,
- System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
- std::vector<std::string> &argv,
- std::vector<std::string> &envp,
- const std::string &cwd,
- uint64_t _uid, uint64_t _euid,
- uint64_t _gid, uint64_t _egid,
- uint64_t _pid, uint64_t _ppid);
+ SparcLiveProcess(LiveProcessParams * params,
+ ObjectFile *objFile, Addr _StackBias);
+
+ void startup();
+
+ template<class IntType>
+ void argsInit(int pageSize);
public:
Addr readSpillStart()
{ return spillStart; }
+ virtual void flushWindows(ThreadContext *tc) = 0;
};
-struct M5_32_auxv_t
+template<class IntType>
+struct M5_auxv_t
{
- int32_t a_type;
+ IntType a_type;
union {
- int32_t a_val;
- int32_t a_ptr;
- int32_t a_fcn;
+ IntType a_val;
+ IntType a_ptr;
+ IntType a_fcn;
};
- M5_32_auxv_t()
+ M5_auxv_t()
{}
- M5_32_auxv_t(int32_t type, int32_t val);
+ M5_auxv_t(IntType type, IntType val)
+ {
+ a_type = SparcISA::htog(type);
+ a_val = SparcISA::htog(val);
+ }
};
class Sparc32LiveProcess : public SparcLiveProcess
{
protected:
- std::vector<M5_32_auxv_t> auxv;
-
- Sparc32LiveProcess(const std::string &nm, ObjectFile *objFile,
- System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
- std::vector<std::string> &argv,
- std::vector<std::string> &envp,
- const std::string &cwd,
- uint64_t _uid, uint64_t _euid,
- uint64_t _gid, uint64_t _egid,
- uint64_t _pid, uint64_t _ppid) :
- SparcLiveProcess(nm, objFile, _system,
- stdin_fd, stdout_fd, stderr_fd,
- argv, envp, cwd,
- _uid, _euid, _gid, _egid, _pid, _ppid)
+ Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
+ SparcLiveProcess(params, objFile, 0)
{
// Set up stack. On SPARC Linux, stack goes from the top of memory
// downward, less the hole for the kernel address space.
void argsInit(int intSize, int pageSize);
-};
-
-struct M5_64_auxv_t
-{
- int64_t a_type;
- union {
- int64_t a_val;
- int64_t a_ptr;
- int64_t a_fcn;
- };
-
- M5_64_auxv_t()
- {}
-
- M5_64_auxv_t(int64_t type, int64_t val);
+ void flushWindows(ThreadContext *tc);
};
class Sparc64LiveProcess : public SparcLiveProcess
{
protected:
- static const Addr StackBias = 2047;
-
- std::vector<M5_64_auxv_t> auxv;
-
- Sparc64LiveProcess(const std::string &nm, ObjectFile *objFile,
- System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
- std::vector<std::string> &argv,
- std::vector<std::string> &envp,
- const std::string &cwd,
- uint64_t _uid, uint64_t _euid,
- uint64_t _gid, uint64_t _egid,
- uint64_t _pid, uint64_t _ppid) :
- SparcLiveProcess(nm, objFile, _system,
- stdin_fd, stdout_fd, stderr_fd,
- argv, envp, cwd,
- _uid, _euid, _gid, _egid, _pid, _ppid)
+ Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
+ SparcLiveProcess(params, objFile, 2047)
{
// Set up stack. On SPARC Linux, stack goes from the top of memory
// downward, less the hole for the kernel address space.
void argsInit(int intSize, int pageSize);
+ void flushWindows(ThreadContext *tc);
};
#endif // __SPARC_PROCESS_HH__