Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/28289 )
Change subject: arm,x86,sim: Use the new return value suppression in
GuestABI.
......................................................................
arm,x86,sim: Use the new return value suppression in GuestABI.
This gets rid of some dummy Return structure definitions. Also augment
the PseudoInst::pseudoInst dispatch function so it can store or not
store results, depending on what's needed at each call sight.
Change-Id: If4a53bc0a27e5214a26ef1a100c99948ca95418d
---
M src/arch/arm/semihosting.cc
M src/arch/x86/tlb.cc
M src/sim/pseudo_inst.hh
3 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/src/arch/arm/semihosting.cc b/src/arch/arm/semihosting.cc
index 7718cd0..2020d92 100644
--- a/src/arch/arm/semihosting.cc
+++ b/src/arch/arm/semihosting.cc
@@ -696,18 +696,6 @@
namespace GuestABI
{
-// Ignore return values since those will be handled by semihosting.
-template <typename T>
-struct Result<SemiPseudoAbi32, T>
-{
- static void store(ThreadContext *tc, const T &ret) {}
-};
-template <typename T>
-struct Result<SemiPseudoAbi64, T>
-{
- static void store(ThreadContext *tc, const T &ret) {}
-};
-
// Handle arguments the same as for semihosting operations. Skipping the
first
// slot is handled internally by the State type.
template <typename T>
diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc
index ceccba8..0e43ceb 100644
--- a/src/arch/x86/tlb.cc
+++ b/src/arch/x86/tlb.cc
@@ -266,7 +266,7 @@
[func, mode](ThreadContext *tc, PacketPtr pkt) -> Cycles
{
uint64_t ret;
- PseudoInst::pseudoInst<X86PseudoInstABI>(tc, func, ret);
+ PseudoInst::pseudoInst<X86PseudoInstABI>(tc, func, ret,
true);
if (mode == Read)
pkt->setLE(ret);
return Cycles(1);
diff --git a/src/sim/pseudo_inst.hh b/src/sim/pseudo_inst.hh
index 6a63812..982d6c8 100644
--- a/src/sim/pseudo_inst.hh
+++ b/src/sim/pseudo_inst.hh
@@ -59,16 +59,6 @@
namespace GuestABI
{
-template <typename T>
-struct Result<PseudoInstABI, T>
-{
- static void
- store(ThreadContext *tc, const T &ret)
- {
- // Don't do anything with the pseudo inst results by default.
- }
-};
-
template <>
struct Argument<PseudoInstABI, uint64_t>
{
@@ -134,9 +124,9 @@
* @return Whether the pseudo instruction was recognized/handled.
*/
-template <typename ABI>
+template <typename ABI, bool store_ret>
bool
-pseudoInst(ThreadContext *tc, uint8_t func, uint64_t &result)
+pseudoInstWork(ThreadContext *tc, uint8_t func, uint64_t &result)
{
DPRINTF(PseudoInst, "PseudoInst::pseudoInst(%i)\n", func);
@@ -160,11 +150,11 @@
return true;
case M5OP_QUIESCE_TIME:
- result = invokeSimcall<ABI>(tc, quiesceTime);
+ result = invokeSimcall<ABI, store_ret>(tc, quiesceTime);
return true;
case M5OP_RPNS:
- result = invokeSimcall<ABI>(tc, rpns);
+ result = invokeSimcall<ABI, store_ret>(tc, rpns);
return true;
case M5OP_WAKE_CPU:
@@ -180,7 +170,7 @@
return true;
case M5OP_INIT_PARAM:
- result = invokeSimcall<ABI>(tc, initParam);
+ result = invokeSimcall<ABI, store_ret>(tc, initParam);
return true;
case M5OP_LOAD_SYMBOL:
@@ -204,11 +194,11 @@
return true;
case M5OP_WRITE_FILE:
- result = invokeSimcall<ABI>(tc, writefile);
+ result = invokeSimcall<ABI, store_ret>(tc, writefile);
return true;
case M5OP_READ_FILE:
- result = invokeSimcall<ABI>(tc, readfile);
+ result = invokeSimcall<ABI, store_ret>(tc, readfile);
return true;
case M5OP_DEBUG_BREAK:
@@ -262,6 +252,21 @@
}
}
+template <typename ABI, bool store_ret=false>
+bool
+pseudoInst(ThreadContext *tc, uint8_t func, uint64_t &result)
+{
+ return pseudoInstWork<ABI, store_ret>(tc, func, result);
+}
+
+template <typename ABI, bool store_ret=true>
+bool
+pseudoInst(ThreadContext *tc, uint8_t func)
+{
+ uint64_t result;
+ return pseudoInstWork<ABI, store_ret>(tc, func, result);
+}
+
} // namespace PseudoInst
#endif // __SIM_PSEUDO_INST_HH__
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/28289
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If4a53bc0a27e5214a26ef1a100c99948ca95418d
Gerrit-Change-Number: 28289
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s