#include <string>
#include <vector>
+#include "sim/byteswap.hh"
#include "sim/process.hh"
class ObjectFile;
class System;
-typedef struct
-{
- int64_t a_type;
- union {
- int64_t a_val;
- Addr a_ptr;
- Addr a_fcn;
- };
-} m5_auxv_t;
-
class SparcLiveProcess : public LiveProcess
{
protected:
- static const Addr StackBias = 2047;
+ const Addr StackBias;
//The locations of the fill and spill handlers
Addr fillStart, spillStart;
- std::vector<m5_auxv_t> auxv;
-
- 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,
- 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:
- void argsInit(int intSize, int pageSize);
+ //Handles traps which request services from the operating system
+ virtual void handleTrap(int trapNum, ThreadContext *tc);
Addr readFillStart()
{ return fillStart; }
Addr readSpillStart()
{ return spillStart; }
+ virtual void flushWindows(ThreadContext *tc) = 0;
+};
+
+template<class IntType>
+struct M5_auxv_t
+{
+ IntType a_type;
+ union {
+ IntType a_val;
+ IntType a_ptr;
+ IntType a_fcn;
+ };
+
+ M5_auxv_t()
+ {}
+
+ M5_auxv_t(IntType type, IntType val)
+ {
+ a_type = SparcISA::htog(type);
+ a_val = SparcISA::htog(val);
+ }
+};
+
+class Sparc32LiveProcess : public SparcLiveProcess
+{
+ protected:
+
+ 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.
+ stack_base = (Addr)0xf0000000ULL;
+
+ // Set up region for mmaps.
+ mmap_start = mmap_end = 0x70000000;
+ }
+
+ void startup();
+
+ public:
+
+ void argsInit(int intSize, int pageSize);
+
+ void flushWindows(ThreadContext *tc);
+};
+
+class Sparc64LiveProcess : public SparcLiveProcess
+{
+ protected:
+
+ 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.
+ stack_base = (Addr)0x80000000000ULL;
+
+ // Set up region for mmaps. Tru64 seems to start just above 0 and
+ // grow up from there.
+ mmap_start = mmap_end = 0xfffff80000000000ULL;
+ }
+
+ void startup();
+
+ public:
+
+ void argsInit(int intSize, int pageSize);
+
+ void flushWindows(ThreadContext *tc);
};
#endif // __SPARC_PROCESS_HH__