X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Farch%2Friscv%2Fprocess.hh;h=05cde41fe8332d186adcd24648b1422ba3982614;hb=55e7d3e5b6f062659bad5f6fdc8469ce80f102dd;hp=933d6d19f6b37f0a3b01d5daf00fb3f3688a4b95;hpb=31e9714364dba399bf0a5243b342e6efe9088669;p=gem5.git diff --git a/src/arch/riscv/process.hh b/src/arch/riscv/process.hh index 933d6d19f..05cde41fe 100644 --- a/src/arch/riscv/process.hh +++ b/src/arch/riscv/process.hh @@ -35,38 +35,67 @@ #include "mem/page_table.hh" #include "sim/process.hh" +#include "sim/syscall_abi.hh" +namespace Loader +{ class ObjectFile; +} // namespace Loader + class System; class RiscvProcess : public Process { protected: - RiscvProcess(ProcessParams * params, ObjectFile *objFile); + RiscvProcess(ProcessParams * params, ::Loader::ObjectFile *objFile); template void argsInit(int pageSize); public: - RegVal getSyscallArg(ThreadContext *tc, int &i) override; - /// Explicitly import the otherwise hidden getSyscallArg - using Process::getSyscallArg; - void setSyscallReturn(ThreadContext *tc, - 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 ArgumentRegs; + }; +}; + +namespace GuestABI +{ + +template <> +struct Result +{ + 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 { protected: - RiscvProcess64(ProcessParams * params, ObjectFile *objFile); + RiscvProcess64(ProcessParams * params, ::Loader::ObjectFile *objFile); void initState() override; }; class RiscvProcess32 : public RiscvProcess { protected: - RiscvProcess32(ProcessParams * params, ObjectFile *objFile); + RiscvProcess32(ProcessParams * params, ::Loader::ObjectFile *objFile); void initState() override; };