+#include "base/varargs.hh"
+
+#if defined(__SUNPRO_CC)
+#define __FUNCTION__ "how to fix me?"
+#endif
+
+// General exit message, these functions will never return and will
+// either abort() if code is < 0 or exit with the code if >= 0
+void __exit_message(const char *prefix, int code,
+ const char *func, const char *file, int line,
+ const char *format, CPRINTF_DECLARATION) M5_ATTR_NORETURN;
+
+void __exit_message(const char *prefix, int code,
+ const char *func, const char *file, int line,
+ const std::string &format, CPRINTF_DECLARATION) M5_ATTR_NORETURN;
+
+inline void
+__exit_message(const char *prefix, int code,
+ const char *func, const char *file, int line,
+ const std::string& format, CPRINTF_DEFINITION)
+{
+ __exit_message(prefix, code, func, file, line, format.c_str(),
+ VARARGS_ALLARGS);
+}
+
+M5_PRAGMA_NORETURN(__exit_message)
+#define exit_message(prefix, code, ...) \
+ __exit_message(prefix, code, __FUNCTION__, __FILE__, __LINE__, \
+ __VA_ARGS__)