Merge with head.
[gem5.git] / src / arch / sparc / process.hh
index dd8eae316a984ace25fc8c5df322dad1f1e149a2..cca312e0ab9d54cde4dd9dafb9cf125dc988d086 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <string>
 #include <vector>
+#include "sim/byteswap.hh"
 #include "sim/process.hh"
 
 class ObjectFile;
@@ -43,10 +44,18 @@ class SparcLiveProcess : public LiveProcess
 {
   protected:
 
+    const Addr StackBias;
+
     //The locations of the fill and spill handlers
     Addr fillStart, spillStart;
 
-    SparcLiveProcess(LiveProcessParams * params, ObjectFile *objFile);
+    SparcLiveProcess(LiveProcessParams * params,
+            ObjectFile *objFile, Addr _StackBias);
+
+    void startup();
+
+    template<class IntType>
+    void argsInit(int pageSize);
 
   public:
 
@@ -60,31 +69,15 @@ class SparcLiveProcess : public LiveProcess
     { return spillStart; }
 
     virtual void flushWindows(ThreadContext *tc) = 0;
-};
-
-struct M5_32_auxv_t
-{
-    int32_t a_type;
-    union {
-        int32_t a_val;
-        int32_t a_ptr;
-        int32_t a_fcn;
-    };
-
-    M5_32_auxv_t()
-    {}
-
-    M5_32_auxv_t(int32_t type, int32_t val);
+    void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
 };
 
 class Sparc32LiveProcess : public SparcLiveProcess
 {
   protected:
 
-    std::vector<M5_32_auxv_t> auxv;
-
     Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
-            SparcLiveProcess(params, 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.
@@ -101,33 +94,17 @@ class Sparc32LiveProcess : public SparcLiveProcess
     void argsInit(int intSize, int pageSize);
 
     void flushWindows(ThreadContext *tc);
-};
-
-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);
+    SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
+    void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
 };
 
 class Sparc64LiveProcess : public SparcLiveProcess
 {
   protected:
 
-    static const Addr StackBias = 2047;
-
-    std::vector<M5_64_auxv_t> auxv;
-
     Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
-            SparcLiveProcess(params, 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.
@@ -145,6 +122,9 @@ class Sparc64LiveProcess : public SparcLiveProcess
     void argsInit(int intSize, int pageSize);
 
     void flushWindows(ThreadContext *tc);
+
+    SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
+    void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
 };
 
 #endif // __SPARC_PROCESS_HH__