summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-02-28 16:36:38 +0000
committerGabe Black <gblack@eecs.umich.edu>2007-02-28 16:36:38 +0000
commit29e5df890d9512a6a2c726dcb4ee46b92ac4cb22 (patch)
tree4858cf8e087521bba01ad78783a5f4a768b5ab26 /src/sim
parent99948060b2863b37c0db5e6b609ff7ff30de6d1b (diff)
downloadgem5-29e5df890d9512a6a2c726dcb4ee46b92ac4cb22.tar.xz
Make trap instructions always generate TrapInstruction Fault objects which call into the Process object to handle system calls. Refactored the Process objects, and move the handler code into it's own file, and add some syscalls which are used in a natively compiled hello world. Software traps with trap number 3 (not syscall number 3) are supposed to cause the register windows to be flushed but are ignored right now. Finally, made uname for SPARC report a 2.6.12 kernel which is what m22-018.pool happens to be running.
--HG-- extra : convert_revision : ea873f01c62234c0542f310cc143c6a7c76ade94
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/process.cc27
-rw-r--r--src/sim/process.hh3
2 files changed, 20 insertions, 10 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index e5d868115..acc509a6f 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -302,20 +302,20 @@ DEFINE_SIM_OBJECT_CLASS_NAME("Process", Process)
void
copyStringArray(vector<string> &strings, Addr array_ptr, Addr data_ptr,
- TranslatingPort* memPort)
+ TranslatingPort* memPort, int ptr_size)
{
Addr data_ptr_swap;
for (int i = 0; i < strings.size(); ++i) {
data_ptr_swap = htog(data_ptr);
- memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr_swap, sizeof(Addr));
+ memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr_swap, ptr_size);
memPort->writeString(data_ptr, strings[i].c_str());
- array_ptr += sizeof(Addr);
+ array_ptr += ptr_size;
data_ptr += strings[i].size() + 1;
}
// add NULL terminator
data_ptr = 0;
- memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr));
+ memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr, ptr_size);
}
LiveProcess::LiveProcess(const string &nm, ObjectFile *_objFile,
@@ -475,14 +475,23 @@ LiveProcess::create(const std::string &nm, System *system, int stdin_fd,
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == SPARC_ISA
- if (objFile->getArch() != ObjectFile::SPARC)
+ if (objFile->getArch() != ObjectFile::SPARC64 && objFile->getArch() != ObjectFile::SPARC32)
fatal("Object file architecture does not match compiled ISA (SPARC).");
switch (objFile->getOpSys()) {
case ObjectFile::Linux:
- process = new SparcLinuxProcess(nm, objFile, system,
- stdin_fd, stdout_fd, stderr_fd,
- argv, envp, cwd,
- _uid, _euid, _gid, _egid, _pid, _ppid);
+ if (objFile->getArch() == ObjectFile::SPARC64) {
+ process = new Sparc64LinuxProcess(nm, objFile, system,
+ stdin_fd, stdout_fd, stderr_fd,
+ argv, envp, cwd,
+ _uid, _euid, _gid,
+ _egid, _pid, _ppid);
+ } else {
+ process = new Sparc32LinuxProcess(nm, objFile, system,
+ stdin_fd, stdout_fd, stderr_fd,
+ argv, envp, cwd,
+ _uid, _euid, _gid,
+ _egid, _pid, _ppid);
+ }
break;
diff --git a/src/sim/process.hh b/src/sim/process.hh
index bf65c6e06..1226db81b 100644
--- a/src/sim/process.hh
+++ b/src/sim/process.hh
@@ -44,6 +44,7 @@
#include <vector>
#include "base/statistics.hh"
+#include "sim/host.hh"
#include "sim/sim_object.hh"
class ThreadContext;
@@ -59,7 +60,7 @@ namespace TheISA
void
copyStringArray(std::vector<std::string> &strings, Addr array_ptr,
- Addr data_ptr, TranslatingPort* memPort);
+ Addr data_ptr, TranslatingPort* memPort, int ptr_size = sizeof(Addr));
class Process : public SimObject
{