summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2011-09-27 00:17:09 -0700
committerGabe Black <gblack@eecs.umich.edu>2011-09-27 00:17:09 -0700
commit2ed3eef9b046472ef20a6c7829e3aa1814d929fb (patch)
treed54595e966de26fd16861d17fb9f1bef7f8726cf /src
parentea79850f903a6015833b339a53dbdb71adecd036 (diff)
downloadgem5-2ed3eef9b046472ef20a6c7829e3aa1814d929fb.tar.xz
Faults: Add in generic faults that work like panics, warns, etc.
These faults take varargs to their constructors which they print into a string and pass to the M5DebugFault base class. They are basically faults wrapped around panics, faults, warns, and warnonce-es so that they happen only at commit.
Diffstat (limited to 'src')
-rw-r--r--src/arch/generic/debugfaults.hh16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/arch/generic/debugfaults.hh b/src/arch/generic/debugfaults.hh
index 3389b0833..2a10ced92 100644
--- a/src/arch/generic/debugfaults.hh
+++ b/src/arch/generic/debugfaults.hh
@@ -47,6 +47,7 @@
namespace GenericISA
{
+
class M5DebugFault : public FaultBase
{
public:
@@ -106,6 +107,21 @@ class M5DebugFault : public FaultBase
}
}
};
+
+template <int func>
+class M5VarArgsFault : public M5DebugFault
+{
+ public:
+ M5VarArgsFault(const std::string &format, CPRINTF_DECLARATION) :
+ M5DebugFault((DebugFunc)func, csprintf(format, VARARGS_ALLARGS))
+ {}
+};
+
+typedef M5VarArgsFault<M5DebugFault::PanicFunc> M5PanicFault;
+typedef M5VarArgsFault<M5DebugFault::FatalFunc> M5FatalFault;
+typedef M5VarArgsFault<M5DebugFault::WarnFunc> M5WarnFault;
+typedef M5VarArgsFault<M5DebugFault::WarnOnceFunc> M5WarnOnceFault;
+
} // namespace GenericISA
#endif // __ARCH_GENERIC_DEBUGFAULTS_HH__