Used as a command in full-system scripts helps the user ensure the benchmarks have finished successfully.
For example, one can use:
/path/to/benchmark args || /sbin/m5 fail 1
and thus ensure gem5 will exit with an error if the benchmark fails.
#
# Authors: Lisa Hsu
+import sys
from os import getcwd
from os.path import join as joinpath
print 'Exiting @ tick %i because %s' % (m5.curTick(), exit_cause)
if options.checkpoint_at_end:
m5.checkpoint(joinpath(cptdir, "cpt.%d"))
+
+ sys.exit(exit_event.getCode())
0x21: m5exit({{
PseudoInst::m5exit(xc->tcBase(), Rdi);
}}, IsNonSpeculative);
+ 0x22: m5fail({{
+ PseudoInst::m5fail(xc->tcBase(), Rdi, Rsi);
+ }}, IsNonSpeculative);
0x30: m5initparam({{
Rax = PseudoInst::initParam(xc->tcBase());
}}, IsNonSpeculative);
exitSimLoop("m5_exit instruction encountered", 0, when);
}
+void
+m5fail(ThreadContext *tc, Tick delay, uint64_t code)
+{
+ Tick when = curTick() + delay * SimClock::Int::ns;
+ exitSimLoop("m5_fail instruction encountered", code, when);
+}
+
void
loadsymbol(ThreadContext *tc)
{
uint64_t rpns(ThreadContext *tc);
void wakeCPU(ThreadContext *tc, uint64_t cpuid);
void m5exit(ThreadContext *tc, Tick delay);
+void m5fail(ThreadContext *tc, Tick delay, uint64_t code);
void resetstats(ThreadContext *tc, Tick delay, Tick period);
void dumpstats(ThreadContext *tc, Tick delay, Tick period);
void dumpresetstats(ThreadContext *tc, Tick delay, Tick period);
m5_exit(ints[0]);
}
+void
+do_fail(int argc, char *argv[])
+{
+ if (argc < 1 || argc > 2)
+ usage();
+
+ m5_fail((argc > 1) ? strtoul(argv[1], NULL, 0) : 0, strtoul(argv[0], NULL, 0));
+}
+
void
do_reset_stats(int argc, char *argv[])
{
struct MainFunc mainfuncs[] = {
{ "exit", do_exit, "[delay]" },
+ { "fail", do_fail, "<code> [delay]" },
{ "resetstats", do_reset_stats, "[delay [period]]" },
{ "dumpstats", do_dump_stats, "[delay [period]]" },
{ "dumpresetstats", do_dump_reset_stats, "[delay [period]]" },
void wakeCPU(uint64_t cpuid);
void m5_exit(uint64_t ns_delay);
+void m5_fail(uint64_t ns_delay, uint64_t code);
uint64_t m5_initparam(void);
void m5_checkpoint(uint64_t ns_delay, uint64_t ns_period);
void m5_reset_stats(uint64_t ns_delay, uint64_t ns_period);
TWO_BYTE_OP(quiesceTime, quiescetime_func)
TWO_BYTE_OP(rpns, rpns_func)
TWO_BYTE_OP(m5_exit, exit_func)
+TWO_BYTE_OP(m5_fail, fail_func)
TWO_BYTE_OP(m5_initparam, initparam_func)
TWO_BYTE_OP(m5_loadsymbol, loadsymbol_func)
TWO_BYTE_OP(m5_reset_stats, resetstats_func)
#define deprecated2_func 0x11 // obsolete ivle
#define deprecated3_func 0x20 // deprecated exit function
#define exit_func 0x21
+#define fail_func 0x22
#define initparam_func 0x30
#define loadsymbol_func 0x31
#define resetstats_func 0x40