summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/faults.cc10
-rw-r--r--sim/faults.hh33
-rw-r--r--sim/process.cc28
3 files changed, 17 insertions, 54 deletions
diff --git a/sim/faults.cc b/sim/faults.cc
index 78bfc8092..9b4a0ea7f 100644
--- a/sim/faults.cc
+++ b/sim/faults.cc
@@ -27,7 +27,11 @@
*/
#include "sim/faults.hh"
+#include "cpu/exec_context.hh"
-FaultName MachineCheckFault::_name = "mchk";
-FaultName AlignmentFault::_name = "unalign";
-
+#if !FULL_SYSTEM
+void FaultBase::invoke(ExecContext * xc)
+{
+ fatal("fault (%s) detected @ PC 0x%08p", name(), xc->readPC());
+}
+#endif
diff --git a/sim/faults.hh b/sim/faults.hh
index 9b8c94cda..9e8d224cd 100644
--- a/sim/faults.hh
+++ b/sim/faults.hh
@@ -53,39 +53,16 @@ class FaultBase : public RefCounted
virtual FaultName name() = 0;
virtual FaultStat & stat() = 0;
#if FULL_SYSTEM
- virtual void ev5_trap(ExecContext * xc) = 0;
+ virtual void invoke(ExecContext * xc) = 0;
+#else
+ virtual void invoke(ExecContext * xc);
#endif
- template<typename T>
- bool isA() {return dynamic_cast<T *>(this);}
+// template<typename T>
+// bool isA() {return dynamic_cast<T *>(this);}
virtual bool isMachineCheckFault() {return false;}
virtual bool isAlignmentFault() {return false;}
};
FaultBase * const NoFault = 0;
-//The ISAs are each responsible for providing a genMachineCheckFault and a
-//genAlignmentFault functions, which return faults to use in the case of a
-//machine check fault or an alignment fault, respectively. Base classes which
-//provide the name() function, and the isMachineCheckFault and isAlignmentFault
-//functions are provided below.
-
-class MachineCheckFault : public virtual FaultBase
-{
- private:
- static FaultName _name;
- public:
- FaultName name() {return _name;}
- bool isMachineCheckFault() {return true;}
-};
-
-class AlignmentFault : public virtual FaultBase
-{
- private:
- static FaultName _name;
- public:
- FaultName name() {return _name;}
- bool isAlignmentFault() {return true;}
-};
-
-
#endif // __FAULTS_HH__
diff --git a/sim/process.cc b/sim/process.cc
index e3cae2855..fddd9a0b9 100644
--- a/sim/process.cc
+++ b/sim/process.cc
@@ -48,8 +48,7 @@
#include "sim/stats.hh"
#include "sim/syscall_emul.hh"
-#include "arch/tru64_process.hh"
-#include "arch/linux_process.hh"
+#include "arch/process.hh"
using namespace std;
using namespace TheISA;
@@ -376,27 +375,10 @@ LiveProcess::create(const string &nm,
fatal("Can't load object file %s", executable);
}
- // check object type & set up syscall emulation pointer
- if (objFile->getArch() == ObjectFile::Alpha) {
- switch (objFile->getOpSys()) {
- case ObjectFile::Tru64:
- process = new AlphaTru64Process(nm, objFile,
- stdin_fd, stdout_fd, stderr_fd,
- argv, envp);
- break;
-
- case ObjectFile::Linux:
- process = new AlphaLinuxProcess(nm, objFile,
- stdin_fd, stdout_fd, stderr_fd,
- argv, envp);
- break;
-
- default:
- fatal("Unknown/unsupported operating system.");
- }
- } else {
- fatal("Unknown object file architecture.");
- }
+ // set up syscall emulation pointer for the current ISA
+ process = createProcess(nm, objFile,
+ stdin_fd, stdout_fd, stderr_fd,
+ argv, envp);
delete objFile;