summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.hh
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2015-05-05 09:25:59 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2015-05-05 09:25:59 -0700
commitc65fa3dceb2163967bbb7199013e9fccdc6ff46c (patch)
treef31fe624e5923d05433fae473512eba6fb39e061 /src/sim/syscall_emul.hh
parent40e180ecbe2e8201c9a0bc9b6676c9f030e95fdd (diff)
downloadgem5-c65fa3dceb2163967bbb7199013e9fccdc6ff46c.tar.xz
syscall_emul: fix warn_once behavior
The current ignoreWarnOnceFunc doesn't really work as expected, since it will only generate one warning total, for whichever "warn-once" syscall is invoked first. This patch fixes that behavior by keeping a "warned" flag in the SyscallDesc object, allowing suitably flagged syscalls to warn exactly once per syscall.
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r--src/sim/syscall_emul.hh11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 8c1a21a65..05f87fd7d 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -97,6 +97,7 @@ class SyscallDesc {
const char *name; //!< Syscall name (e.g., "open").
FuncPtr funcPtr; //!< Pointer to emulation function.
int flags; //!< Flags (see Flags enum).
+ bool warned; //!< Have we warned about unimplemented syscall?
/// Flag values for controlling syscall behavior.
enum Flags {
@@ -104,17 +105,21 @@ class SyscallDesc {
/// Used for syscalls with non-standard return conventions
/// that explicitly set the ThreadContext regs (e.g.,
/// sigreturn).
- SuppressReturnValue = 1
+ SuppressReturnValue = 1,
+ WarnOnce = 2
};
/// Constructor.
SyscallDesc(const char *_name, FuncPtr _funcPtr, int _flags = 0)
- : name(_name), funcPtr(_funcPtr), flags(_flags)
+ : name(_name), funcPtr(_funcPtr), flags(_flags), warned(false)
{
}
/// Emulate the syscall. Public interface for calling through funcPtr.
void doSyscall(int callnum, LiveProcess *proc, ThreadContext *tc);
+
+ /// Is the WarnOnce flag set?
+ bool warnOnce() const { return (flags & WarnOnce); }
};
@@ -137,8 +142,6 @@ SyscallReturn unimplementedFunc(SyscallDesc *desc, int num,
/// trace flag is enabled. Return success to the target program.
SyscallReturn ignoreFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
-SyscallReturn ignoreWarnOnceFunc(SyscallDesc *desc, int num,
- LiveProcess *p, ThreadContext *tc);
/// Target exit() handler: terminate current context.
SyscallReturn exitFunc(SyscallDesc *desc, int num,