#include <string>
#include <vector>
+
+#include "sim/byteswap.hh"
#include "sim/process.hh"
class ObjectFile;
class System;
-typedef struct
+class SparcLiveProcess : public LiveProcess
{
- int64_t a_type;
- union {
- int64_t a_val;
- Addr a_ptr;
- Addr a_fcn;
- };
-} m5_auxv_t;
+ protected:
-class SparcLiveProcess : public LiveProcess
+ const Addr StackBias;
+
+ // The locations of the fill and spill handlers
+ Addr fillStart, spillStart;
+
+ SparcLiveProcess(LiveProcessParams * params,
+ ObjectFile *objFile, Addr _StackBias);
+
+ void initState();
+
+ template<class IntType>
+ void argsInit(int pageSize);
+
+ public:
+
+ // 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;
+ void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
+};
+
+class Sparc32LiveProcess : public SparcLiveProcess
{
protected:
- static const Addr StackBias = 2047;
+ 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;
- std::vector<m5_auxv_t> auxv;
+ // Set up region for mmaps.
+ mmap_end = 0x70000000;
+ }
- 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);
+ void initState();
- void startup();
+ public:
+
+ void argsInit(int intSize, int pageSize);
+
+ void flushWindows(ThreadContext *tc);
+
+ SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
+ /// Explicitly import the otherwise hidden getSyscallArg
+ using LiveProcess::getSyscallArg;
+
+ void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
+};
+
+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.
+ mmap_end = 0xfffff80000000000ULL;
+ }
+
+ void initState();
public:
- // 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 SparcLiveProcess *create(const std::string &nm,
- System *_system,
- int stdin_fd, int stdout_fd, int stderr_fd,
- std::string executable,
- std::vector<std::string> &argv,
- std::vector<std::string> &envp);
void argsInit(int intSize, int pageSize);
+ void flushWindows(ThreadContext *tc);
+
+ SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
+ /// Explicitly import the otherwise hidden getSyscallArg
+ using LiveProcess::getSyscallArg;
+
+ void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
};
+/* No architectural page table defined for this ISA */
+typedef NoArchPageTable ArchPageTable;
+
#endif // __SPARC_PROCESS_HH__