Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/23451 )
Change subject: mips: Use a mips specific GuestABI for mips system calls.
......................................................................
mips: Use a mips specific GuestABI for mips system calls.
Change-Id: Ice9fb867b47e56bc00b171399a82b2892b16c9e4
---
M src/arch/mips/linux/process.cc
M src/arch/mips/linux/process.hh
M src/arch/mips/process.cc
M src/arch/mips/process.hh
4 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc
index 1f3ee99..15cdce1 100644
--- a/src/arch/mips/linux/process.cc
+++ b/src/arch/mips/linux/process.cc
@@ -154,7 +154,7 @@
return 0;
}
-SyscallDescABI<DefaultSyscallABI> MipsLinuxProcess::syscallDescs[] = {
+SyscallDescABI<MipsProcess::SyscallABI> MipsLinuxProcess::syscallDescs[] =
{
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },
diff --git a/src/arch/mips/linux/process.hh b/src/arch/mips/linux/process.hh
index b2ab91e..361390c 100644
--- a/src/arch/mips/linux/process.hh
+++ b/src/arch/mips/linux/process.hh
@@ -55,7 +55,7 @@
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;
};
diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc
index 9f90623..8e279cf 100644
--- a/src/arch/mips/process.cc
+++ b/src/arch/mips/process.cc
@@ -215,3 +215,7 @@
if (sysret.count() > 1)
tc->setIntReg(SyscallPseudoReturnReg, sysret.value2());
}
+
+const std::vector<int> MipsProcess::SyscallABI::ArgumentRegs = {
+ 4, 5, 6, 7, 8, 9
+};
diff --git a/src/arch/mips/process.hh b/src/arch/mips/process.hh
index fb31bef..20fbacf 100644
--- a/src/arch/mips/process.hh
+++ b/src/arch/mips/process.hh
@@ -37,6 +37,7 @@
#include "mem/page_table.hh"
#include "sim/process.hh"
+#include "sim/syscall_abi.hh"
class ObjectFile;
@@ -55,6 +56,39 @@
/// 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__
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23451
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ice9fb867b47e56bc00b171399a82b2892b16c9e4
Gerrit-Change-Number: 23451
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev