Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/23450 )

Change subject: alpha: Use an alpha specific GuestABI for alpha system calls.
......................................................................

alpha: Use an alpha specific GuestABI for alpha system calls.

Change-Id: If13e8ff9d20ddafac494cdfb729d9a678d787fcf
---
M src/arch/alpha/linux/process.cc
M src/arch/alpha/linux/process.hh
M src/arch/alpha/process.cc
M src/arch/alpha/process.hh
4 files changed, 43 insertions(+), 2 deletions(-)



diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc
index a1c026e..caa918c 100644
--- a/src/arch/alpha/linux/process.cc
+++ b/src/arch/alpha/linux/process.cc
@@ -144,7 +144,7 @@
 }


-SyscallDescABI<DefaultSyscallABI> AlphaLinuxProcess::syscallDescs[] = {
+SyscallDescABI<AlphaProcess::SyscallABI> AlphaLinuxProcess::syscallDescs[] = {
     /*  0 */ { "osf_syscall" },
     /*  1 */ { "exit", exitFunc },
     /*  2 */ { "fork" },
diff --git a/src/arch/alpha/linux/process.hh b/src/arch/alpha/linux/process.hh
index 14214f1..af2ebf1 100644
--- a/src/arch/alpha/linux/process.hh
+++ b/src/arch/alpha/linux/process.hh
@@ -49,7 +49,7 @@
     virtual SyscallDesc* getDesc(int callnum);

      /// 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/alpha/process.cc b/src/arch/alpha/process.cc
index f40b771..8571f0e 100644
--- a/src/arch/alpha/process.cc
+++ b/src/arch/alpha/process.cc
@@ -240,3 +240,7 @@
     if (sysret.count() > 1)
         tc->setIntReg(SyscallPseudoReturnReg, sysret.value2());
 }
+
+const std::vector<int> AlphaProcess::SyscallABI::ArgumentRegs = {
+    16, 17, 18, 19, 20, 21
+};
diff --git a/src/arch/alpha/process.hh b/src/arch/alpha/process.hh
index c4d4f6b..8ff72bc 100644
--- a/src/arch/alpha/process.hh
+++ b/src/arch/alpha/process.hh
@@ -34,6 +34,7 @@

 #include "mem/page_table.hh"
 #include "sim/process.hh"
+#include "sim/syscall_abi.hh"

 class AlphaProcess : public Process
 {
@@ -58,6 +59,42 @@
     // override default implementation in Process as the mmap
     // region for Alpha platforms grows upward
     virtual bool mmapGrowsDown() const override { return false; }
+
+    struct SyscallABI : public GenericSyscallABI64
+    {
+        static const std::vector<int> ArgumentRegs;
+    };
 };

+namespace GuestABI
+{
+
+template <>
+struct Result<AlphaProcess::SyscallABI, SyscallReturn>
+{
+    static void
+    store(ThreadContext *tc, const SyscallReturn &ret)
+    {
+        if (ret.suppressed() || ret.needsRetry())
+            return;
+
+        // check for error condition.  Alpha syscall convention is to
+        // indicate success/failure in reg a3 (r19) and put the
+        // return value itself in the standard return value reg (v0).
+        if (ret.successful()) {
+            // no error
+            tc->setIntReg(AlphaISA::SyscallSuccessReg, 0);
+            tc->setIntReg(AlphaISA::ReturnValueReg, ret.returnValue());
+        } else {
+            // got an error, return details
+            tc->setIntReg(AlphaISA::SyscallSuccessReg, (RegVal)-1);
+            tc->setIntReg(AlphaISA::ReturnValueReg, ret.errnoValue());
+        }
+        if (ret.count() > 1)
+            tc->setIntReg(AlphaISA::SyscallPseudoReturnReg, ret.value2());
+    }
+};
+
+} // namespace GuestABI
+
 #endif // __ARCH_ALPHA_PROCESS_HH__

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23450
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: If13e8ff9d20ddafac494cdfb729d9a678d787fcf
Gerrit-Change-Number: 23450
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

Reply via email to