return 0;
}
-std::map<int, SyscallDescABI<DefaultSyscallABI>>
+std::map<int, SyscallDescABI<RiscvProcess::SyscallABI>>
RiscvLinuxProcess64::syscallDescs = {
{0, { "io_setup" }},
{1, { "io_destroy" }},
{2011, { "getmainvars" }}
};
-std::map<int, SyscallDescABI<DefaultSyscallABI>>
+std::map<int, SyscallDescABI<RiscvProcess::SyscallABI>>
RiscvLinuxProcess32::syscallDescs = {
{0, { "io_setup" }},
{1, { "io_destroy" }},
void syscall(ThreadContext *tc, Fault *fault) override;
/// Array of syscall descriptors, indexed by call number.
- static std::map<int, SyscallDescABI<DefaultSyscallABI>> syscallDescs;
+ static std::map<int, SyscallDescABI<SyscallABI>> syscallDescs;
};
class RiscvLinuxProcess32 : public RiscvProcess32
void syscall(ThreadContext *tc, Fault *fault) override;
/// Array of syscall descriptors, indexed by call number.
- static std::map<int, SyscallDescABI<DefaultSyscallABI>> syscallDescs;
+ static std::map<int, SyscallDescABI<SyscallABI>> syscallDescs;
};
#endif // __RISCV_LINUX_PROCESS_HH__
tc->setIntReg(SyscallPseudoReturnReg, sysret.encodedValue());
}
}
+
+const std::vector<int> RiscvProcess::SyscallABI::ArgumentRegs = {
+ 10, 11, 12, 13, 14, 15, 16
+};
#include "mem/page_table.hh"
#include "sim/process.hh"
+#include "sim/syscall_abi.hh"
class ObjectFile;
class System;
SyscallReturn return_value) override;
virtual bool mmapGrowsDown() const override { return false; }
+
+ //FIXME RISCV needs to handle 64 bit arguments in its 32 bit ISA.
+ struct SyscallABI : public GenericSyscallABI64
+ {
+ static const std::vector<int> ArgumentRegs;
+ };
+};
+
+namespace GuestABI
+{
+
+template <>
+struct Result<RiscvProcess::SyscallABI, SyscallReturn>
+{
+ static void
+ store(ThreadContext *tc, const SyscallReturn &ret)
+ {
+ if (ret.suppressed() || ret.needsRetry())
+ return;
+
+ if (ret.successful()) {
+ // no error
+ tc->setIntReg(RiscvISA::ReturnValueReg, ret.returnValue());
+ } else {
+ // got an error, return details
+ tc->setIntReg(RiscvISA::ReturnValueReg, ret.encodedValue());
+ }
+ }
+};
+
};
class RiscvProcess64 : public RiscvProcess