Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/39320 )
Change subject: arm,kern: Stop using the getArgument function for kernel
events.
......................................................................
arm,kern: Stop using the getArgument function for kernel events.
This change plumbs through an ABI to use with the GuestABI mechanism so
that the ISA switched getArgument function is no longer used.
Change-Id: I0d394dcfd7ad6fa745b6ef2aa62973167108f0c3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39320
Reviewed-by: Bobby R. Bruce <[email protected]>
Reviewed-by: Giacomo Travaglini <[email protected]>
Maintainer: Giacomo Travaglini <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/arm/freebsd/fs_workload.cc
M src/arch/arm/fs_workload.hh
M src/arch/arm/linux/fs_workload.cc
M src/kern/freebsd/events.cc
M src/kern/freebsd/events.hh
M src/kern/linux/events.cc
M src/kern/linux/events.hh
7 files changed, 64 insertions(+), 37 deletions(-)
Approvals:
Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
Bobby R. Bruce: Looks good to me, but someone else must approve
kokoro: Regressions pass
diff --git a/src/arch/arm/freebsd/fs_workload.cc
b/src/arch/arm/freebsd/fs_workload.cc
index cc0151b..7cd7a03 100644
--- a/src/arch/arm/freebsd/fs_workload.cc
+++ b/src/arch/arm/freebsd/fs_workload.cc
@@ -68,8 +68,7 @@
"oops_exit", "Kernel oops in guest");
}
- skipUDelay = addKernelFuncEvent<SkipUDelay<ArmISA::SkipFunc>>(
- "DELAY", "DELAY", 1000, 0);
+ skipUDelay = addSkipFunc<SkipUDelay>("DELAY", "DELAY", 1000, 0);
}
void
diff --git a/src/arch/arm/fs_workload.hh b/src/arch/arm/fs_workload.hh
index 4461670..d7f1738 100644
--- a/src/arch/arm/fs_workload.hh
+++ b/src/arch/arm/fs_workload.hh
@@ -44,6 +44,8 @@
#include <memory>
#include <vector>
+#include "arch/arm/aapcs32.hh"
+#include "arch/arm/aapcs64.hh"
#include "kern/linux/events.hh"
#include "params/ArmFsWorkload.hh"
#include "sim/kernel_workload.hh"
@@ -86,6 +88,34 @@
*/
Loader::ObjectFile *getBootLoader(Loader::ObjectFile *const obj);
+ template <template <class ABI, class Base> class FuncEvent,
+ typename... Args>
+ PCEvent *
+ addSkipFunc(Args... args)
+ {
+ if (getArch() == Loader::Arm64) {
+ return addKernelFuncEvent<FuncEvent<Aapcs64, SkipFunc>>(
+ std::forward<Args>(args)...);
+ } else {
+ return addKernelFuncEvent<FuncEvent<Aapcs32, SkipFunc>>(
+ std::forward<Args>(args)...);
+ }
+ }
+
+ template <template <class ABI, class Base> class FuncEvent,
+ typename... Args>
+ PCEvent *
+ addSkipFuncOrPanic(Args... args)
+ {
+ if (getArch() == Loader::Arm64) {
+ return addKernelFuncEventOrPanic<FuncEvent<Aapcs64, SkipFunc>>(
+ std::forward<Args>(args)...);
+ } else {
+ return addKernelFuncEventOrPanic<FuncEvent<Aapcs32, SkipFunc>>(
+ std::forward<Args>(args)...);
+ }
+ }
+
public:
typedef ArmFsWorkloadParams Params;
const Params &
diff --git a/src/arch/arm/linux/fs_workload.cc
b/src/arch/arm/linux/fs_workload.cc
index b296b68..3c29298 100644
--- a/src/arch/arm/linux/fs_workload.cc
+++ b/src/arch/arm/linux/fs_workload.cc
@@ -230,28 +230,23 @@
// With ARM udelay() is #defined to __udelay
// newer kernels use __loop_udelay and __loop_const_udelay symbols
- skipUDelay = addKernelFuncEvent<SkipUDelay<SkipFunc>>(
+ skipUDelay = addSkipFunc<SkipUDelay>(
"__loop_udelay", "__udelay", 1000, 0);
- if (!skipUDelay)
- skipUDelay = addKernelFuncEventOrPanic<SkipUDelay<SkipFunc>>(
- "__udelay", "__udelay", 1000, 0);
+ if (!skipUDelay) {
+ skipUDelay = addSkipFuncOrPanic<SkipUDelay>(
+ "__udelay", "__udelay", 1000, 0);
+ }
// constant arguments to udelay() have some precomputation done ahead
of
// time. Constant comes from code.
- skipConstUDelay = addKernelFuncEvent<SkipUDelay<SkipFunc>>(
+ skipConstUDelay = addSkipFunc<SkipUDelay>(
"__loop_const_udelay", "__const_udelay", 1000, 107374);
if (!skipConstUDelay) {
- skipConstUDelay = addKernelFuncEventOrPanic<SkipUDelay<SkipFunc>>(
+ skipConstUDelay = addSkipFuncOrPanic<SkipUDelay>(
"__const_udelay", "__const_udelay", 1000, 107374);
}
- if (getArch() == Loader::Arm64) {
- debugPrintk = addKernelFuncEvent<
- DebugPrintk<SkipFuncLinux64>>("dprintk");
- } else {
- debugPrintk = addKernelFuncEvent<
- DebugPrintk<SkipFuncLinux32>>("dprintk");
- }
+ debugPrintk = addSkipFunc<DebugPrintk>("dprintk");
}
void
diff --git a/src/kern/freebsd/events.cc b/src/kern/freebsd/events.cc
index 0c4c613..e6b66fa 100644
--- a/src/kern/freebsd/events.cc
+++ b/src/kern/freebsd/events.cc
@@ -45,13 +45,8 @@
{
void
-onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul)
+onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul, uint64_t time)
{
- int arg_num = 0;
-
- // Get the time in native size
- uint64_t time = TheISA::getArgument(tc, arg_num, (uint16_t)-1, false);
-
// convert parameter to ns
if (div)
time /= div;
diff --git a/src/kern/freebsd/events.hh b/src/kern/freebsd/events.hh
index 79894b6..ebf6128 100644
--- a/src/kern/freebsd/events.hh
+++ b/src/kern/freebsd/events.hh
@@ -34,18 +34,19 @@
#define __KERN_FREEBSD_EVENTS_HH__
#include "kern/system_events.hh"
+#include "sim/guest_abi.hh"
namespace FreeBSD
{
-void onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul);
+void onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul, uint64_t
time);
/** A class to skip udelay() and related calls in the kernel.
- * This class has two additional parameters that take the argument to
udelay and
- * manipulated it to come up with ns and eventually ticks to quiesce for.
+ * This class has two additional parameters that take the argument to
udelay
+ * and manipulated it to come up with ns and eventually ticks to quiesce
for.
* See descriptions of argDivToNs and argMultToNs below.
*/
-template <typename Base>
+template <typename ABI, typename Base>
class SkipUDelay : public Base
{
private:
@@ -69,7 +70,13 @@
void
process(ThreadContext *tc) override
{
- onUDelay(tc, argDivToNs, argMultToNs);
+ // Use Addr since it's handled specially and will act as a natively
+ // sized data type.
+ std::function<void(ThreadContext *, Addr)> call_udelay =
+ [this](ThreadContext *tc, Addr time) {
+ onUDelay(tc, argDivToNs, argMultToNs, time);
+ };
+ invokeSimcall<ABI>(tc, call_udelay);
Base::process(tc);
}
};
diff --git a/src/kern/linux/events.cc b/src/kern/linux/events.cc
index db487e8..8ae76b3 100644
--- a/src/kern/linux/events.cc
+++ b/src/kern/linux/events.cc
@@ -78,13 +78,8 @@
}
void
-onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul)
+onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul, uint64_t time)
{
- int arg_num = 0;
-
- // Get the time in native size
- uint64_t time = TheISA::getArgument(tc, arg_num, (uint16_t)-1, false);
-
// convert parameter to ns
if (div)
time /= div;
diff --git a/src/kern/linux/events.hh b/src/kern/linux/events.hh
index 2ca97a4..8785345 100644
--- a/src/kern/linux/events.hh
+++ b/src/kern/linux/events.hh
@@ -56,7 +56,7 @@
namespace Linux
{
-template <typename Base>
+template <typename ABI, typename Base>
class DebugPrintk : public Base
{
public:
@@ -71,7 +71,7 @@
PrintkVarArgs args) -> int {
return printk(str, tc, format_ptr, args);
};
- invokeSimcall<typename Base::ABI>(tc, func);
+ invokeSimcall<ABI>(tc, func);
DPRINTFN("%s", str);
}
Base::process(tc);
@@ -120,7 +120,7 @@
void process(ThreadContext *tc) override;
};
-void onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul);
+void onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul, uint64_t
time);
/**
* A class to skip udelay() and related calls in the kernel.
@@ -128,7 +128,7 @@
* and manipulated it to come up with ns and eventually ticks to quiesce
for.
* See descriptions of argDivToNs and argMultToNs below.
*/
-template <typename Base>
+template <typename ABI, typename Base>
class SkipUDelay : public Base
{
private:
@@ -156,7 +156,13 @@
void
process(ThreadContext *tc) override
{
- onUDelay(tc, argDivToNs, argMultToNs);
+ // Use Addr since it's handled specially and will act as a natively
+ // sized data type.
+ std::function<void(ThreadContext *, Addr)> call_udelay =
+ [this](ThreadContext *tc, Addr time) {
+ onUDelay(tc, argDivToNs, argMultToNs, time);
+ };
+ invokeSimcall<ABI>(tc, call_udelay);
Base::process(tc);
}
};
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39320
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: I0d394dcfd7ad6fa745b6ef2aa62973167108f0c3
Gerrit-Change-Number: 39320
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s