return 0;
}
-SyscallDescABI<DefaultSyscallABI> MipsLinuxProcess::syscallDescs[] = {
+SyscallDescABI<MipsProcess::SyscallABI> MipsLinuxProcess::syscallDescs[] = {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },
void syscall(ThreadContext *tc, Fault *fault) override;
/// Array of syscall descriptors, indexed by call number.
- static SyscallDescABI<DefaultSyscallABI> syscallDescs[];
+ static SyscallDescABI<SyscallABI> syscallDescs[];
const int Num_Syscall_Descs;
};
#include "mem/page_table.hh"
#include "sim/process.hh"
+#include "sim/syscall_abi.hh"
class ObjectFile;
/// Explicitly import the otherwise hidden getSyscallArg
using Process::getSyscallArg;
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
+
+ struct SyscallABI : public GenericSyscallABI64
+ {
+ static const std::vector<int> ArgumentRegs;
+ };
+};
+
+namespace GuestABI
+{
+
+template <>
+struct Result<MipsProcess::SyscallABI, SyscallReturn>
+{
+ static void
+ store(ThreadContext *tc, const SyscallReturn &ret)
+ {
+ if (ret.suppressed() || ret.needsRetry())
+ return;
+
+ if (ret.successful()) {
+ // no error
+ tc->setIntReg(MipsISA::SyscallSuccessReg, 0);
+ tc->setIntReg(MipsISA::ReturnValueReg, ret.returnValue());
+ } else {
+ // got an error, return details
+ tc->setIntReg(MipsISA::SyscallSuccessReg, (uint32_t)(-1));
+ tc->setIntReg(MipsISA::ReturnValueReg, ret.errnoValue());
+ }
+ if (ret.count() > 1)
+ tc->setIntReg(MipsISA::SyscallPseudoReturnReg, ret.value2());
+ }
};
+} // namespace GuestABI
+
#endif // __MIPS_PROCESS_HH__