summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'cpu')
-rw-r--r--cpu/exec_context.cc2
-rw-r--r--cpu/exec_context.hh30
-rw-r--r--cpu/simple_cpu/simple_cpu.cc1
3 files changed, 30 insertions, 3 deletions
diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc
index 92144bd93..7332b86a6 100644
--- a/cpu/exec_context.cc
+++ b/cpu/exec_context.cc
@@ -34,7 +34,7 @@
#ifdef FULL_SYSTEM
#include "sim/system.hh"
#else
-#include "sim/prog.hh"
+#include "sim/process.hh"
#endif
using namespace std;
diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh
index 274a3778b..7999e3735 100644
--- a/cpu/exec_context.hh
+++ b/cpu/exec_context.hh
@@ -52,7 +52,7 @@ class MemoryController;
#else // !FULL_SYSTEM
-#include "sim/prog.hh"
+#include "sim/process.hh"
#endif // FULL_SYSTEM
@@ -376,6 +376,34 @@ class ExecContext
#endif
#ifndef FULL_SYSTEM
+ IntReg getSyscallArg(int i)
+ {
+ return regs.intRegFile[ArgumentReg0 + i];
+ }
+
+ // used to shift args for indirect syscall
+ void setSyscallArg(int i, IntReg val)
+ {
+ regs.intRegFile[ArgumentReg0 + i] = val;
+ }
+
+ void setSyscallReturn(int64_t return_value)
+ {
+ // check for error condition. Alpha syscall convention is to
+ // indicate success/failure in reg a3 (r19) and put the
+ // return value itself in the standard return value reg (v0).
+ const int RegA3 = 19; // only place this is used
+ if (return_value >= 0) {
+ // no error
+ regs.intRegFile[RegA3] = 0;
+ regs.intRegFile[ReturnValueReg] = return_value;
+ } else {
+ // got an error, return details
+ regs.intRegFile[RegA3] = (IntReg) -1;
+ regs.intRegFile[ReturnValueReg] = -return_value;
+ }
+ }
+
void syscall()
{
process->syscall(this);
diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc
index a63f86098..476f28ea0 100644
--- a/cpu/simple_cpu/simple_cpu.cc
+++ b/cpu/simple_cpu/simple_cpu.cc
@@ -70,7 +70,6 @@
#else // !FULL_SYSTEM
#include "eio/eio.hh"
#include "mem/functional_mem/functional_memory.hh"
-#include "sim/prog.hh"
#endif // FULL_SYSTEM
using namespace std;