Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/23452 )
Change subject: power: Use a power specific GuestABI for power system calls.
......................................................................
power: Use a power specific GuestABI for power system calls.
Change-Id: I39cf64c025c284b63980f3c2e48fbd8b6c355d2b
---
M src/arch/power/linux/process.cc
M src/arch/power/linux/process.hh
M src/arch/power/process.cc
M src/arch/power/process.hh
4 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/src/arch/power/linux/process.cc
b/src/arch/power/linux/process.cc
index a7232d8..13d7c85 100644
--- a/src/arch/power/linux/process.cc
+++ b/src/arch/power/linux/process.cc
@@ -95,7 +95,7 @@
return 0;
}
-SyscallDescABI<DefaultSyscallABI> PowerLinuxProcess::syscallDescs[] = {
+SyscallDescABI<PowerProcess::SyscallABI> PowerLinuxProcess::syscallDescs[]
= {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },
diff --git a/src/arch/power/linux/process.hh
b/src/arch/power/linux/process.hh
index 60b38a1..1c9230d 100644
--- a/src/arch/power/linux/process.hh
+++ b/src/arch/power/linux/process.hh
@@ -54,7 +54,7 @@
using Process::getSyscallArg;
/// 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/power/process.cc b/src/arch/power/process.cc
index fdef2fa..c095879 100644
--- a/src/arch/power/process.cc
+++ b/src/arch/power/process.cc
@@ -291,3 +291,7 @@
tc->setIntReg(INTREG_CR, cr);
tc->setIntReg(ReturnValueReg, sysret.encodedValue());
}
+
+const std::vector<int> PowerProcess::SyscallABI::ArgumentRegs = {
+ 3, 4, 5, 6, 7
+};
diff --git a/src/arch/power/process.hh b/src/arch/power/process.hh
index f746f11..db43461 100644
--- a/src/arch/power/process.hh
+++ b/src/arch/power/process.hh
@@ -38,6 +38,7 @@
#include "mem/page_table.hh"
#include "sim/process.hh"
+#include "sim/syscall_abi.hh"
class ObjectFile;
@@ -54,7 +55,37 @@
/// 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<PowerProcess::SyscallABI, SyscallReturn>
+{
+ static void
+ store(ThreadContext *tc, const SyscallReturn &ret)
+ {
+ if (ret.suppressed() || ret.needsRetry())
+ return;
+
+ PowerISA::Cr cr = tc->readIntReg(PowerISA::INTREG_CR);
+ if (ret.successful()) {
+ cr.cr0.so = 0;
+ } else {
+ cr.cr0.so = 1;
+ }
+ tc->setIntReg(PowerISA::INTREG_CR, cr);
+ tc->setIntReg(PowerISA::ReturnValueReg, ret.encodedValue());
+ }
+};
+
+} // namespace GuestABI
+
#endif // __POWER_PROCESS_HH__
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23452
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: I39cf64c025c284b63980f3c2e48fbd8b6c355d2b
Gerrit-Change-Number: 23452
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