#include "sim/syscall_desc.hh"
+#include <memory>
+
#include "base/trace.hh"
+#include "base/types.hh"
#include "config/the_isa.hh"
#include "cpu/base.hh"
#include "cpu/thread_context.hh"
+#include "sim/faults.hh"
#include "sim/process.hh"
#include "sim/syscall_debug_macros.hh"
#include "sim/syscall_return.hh"
void
-SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc)
+SyscallDesc::doSyscall(int callnum, ThreadContext *tc, Fault *fault)
{
- TheISA::IntReg arg[6] M5_VAR_USED;
+ RegVal arg[6] M5_VAR_USED;
+ auto process = tc->getProcessPtr();
/**
* Step through the first six parameters for the system call and
* retrieve their values. Note that index is incremented as a
- * side-effect of the getSyscallArg method which is why the LHS
- * needs the "-1".
+ * side-effect of the getSyscallArg method.
*/
- for (int index = 0; index < 6; )
- arg[index - 1] = process->getSyscallArg(tc, index);
+ int index = 0;
+ for (int i = 0; i < 6; i++)
+ arg[i] = process->getSyscallArg(tc, index);
/**
* Linux supports up to six system call arguments through registers
_name, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]);
/** Invoke the system call */
- SyscallReturn retval = (*executor)(this, callnum, process, tc);
+ SyscallReturn retval = (*executor)(this, callnum, tc);
/**
* If the system call needs to be restarted, most likely due to
* blocking behavior, warn that the system call will retry;
* alternatively, print the return value.
*/
- if (retval.needsRetry())
+ if (retval.needsRetry()) {
+ *fault = std::make_shared<SyscallRetryFault>();
DPRINTF_SYSCALL(Base, "%s needs retry\n", _name);
- else
+ } else
DPRINTF_SYSCALL(Base, "%s returns %d\n", _name, retval.encodedValue());
if (!(_flags & SyscallDesc::SuppressReturnValue) && !retval.needsRetry())