Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/23168 )
Change subject: sim: Reintroduce the ignoreWarnOnceFunc syscall handler.
......................................................................
sim: Reintroduce the ignoreWarnOnceFunc syscall handler.
Instead of just using warn_once, we'll gate each warning on a bool
which is associated with the syscall desc pointer. To avoid having to
keep warn once bookkeeping in every syscall desc, we put it in a map
which is looked up at runtime.
Jira Issue: https://gem5.atlassian.net/browse/GEM5-187
Change-Id: I1dcce48de91b8a635f9f3df3bfc0ed6ba1291c4f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23168
Maintainer: Gabe Black <gabebl...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Reviewed-by: Jason Lowe-Power <ja...@lowepower.com>
Reviewed-by: Brandon Potter <brandon.pot...@amd.com>
---
M src/sim/syscall_emul.cc
M src/sim/syscall_emul.hh
2 files changed, 20 insertions(+), 5 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved
Brandon Potter: Looks good to me, approved
Giacomo Travaglini: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 8dc055c..f064fd8 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -39,6 +39,7 @@
#include <iostream>
#include <mutex>
#include <string>
+#include <unordered_map>
#include "arch/utility.hh"
#include "base/chunk_generator.hh"
@@ -75,9 +76,20 @@
SyscallReturn
ignoreFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
{
- if (desc->needWarning()) {
- warn("ignoring syscall %s(...)%s", desc->name(), desc->warnOnce() ?
- "\n (further warnings will be suppressed)" : "");
+ warn("ignoring syscall %s(...)", desc->name());
+ return 0;
+}
+
+SyscallReturn
+ignoreWarnOnceFunc(SyscallDesc *desc, int num, ThreadContext *tc)
+{
+ static std::unordered_map<SyscallDesc *, bool> bool_map;
+
+ bool &warned = bool_map[desc];
+ if (!warned) {
+ warn("ignoring syscall %s(...)\n"
+ " (further warnings will be suppressed)", desc->name());
+ warned = true;
}
return 0;
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index e467b0b..f7d87d4 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -127,9 +127,12 @@
/// Handler for unimplemented syscalls that we never intend to
/// implement (signal handling, etc.) and should not affect the correct
-/// behavior of the program. Print a warning only if the appropriate
-/// trace flag is enabled. Return success to the target program.
+/// behavior of the program. Prints a warning. Return success to the
target
+/// program.
SyscallReturn ignoreFunc(SyscallDesc *desc, int num, ThreadContext *tc);
+/// Like above, but only prints a warning once per syscall desc it's used
with.
+SyscallReturn
+ignoreWarnOnceFunc(SyscallDesc *desc, int num, ThreadContext *tc);
// Target fallocateFunc() handler.
SyscallReturn fallocateFunc(SyscallDesc *desc, int num, ThreadContext *tc);
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23168
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: I1dcce48de91b8a635f9f3df3bfc0ed6ba1291c4f
Gerrit-Change-Number: 23168
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Brandon Potter <brandon.pot...@amd.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev