summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2013-01-08 08:54:12 -0500
committerLluís Vilanova <vilanova@ac.upc.edu>2013-01-08 08:54:12 -0500
commit807168a1de1b101622d084c5fe160cf41ff3f59d (patch)
tree171b272f8fa038c30aceb957a0e259f9419be775 /util
parent858d99b7cc6515aa6a0e75859aa7b5f460b40bb7 (diff)
downloadgem5-807168a1de1b101622d084c5fe160cf41ff3f59d.tar.xz
util: add m5_fail op.
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.
Diffstat (limited to 'util')
-rw-r--r--util/m5/m5.c10
-rw-r--r--util/m5/m5op.h1
-rw-r--r--util/m5/m5op_x86.S1
-rw-r--r--util/m5/m5ops.h1
4 files changed, 13 insertions, 0 deletions
diff --git a/util/m5/m5.c b/util/m5/m5.c
index e9fe8f1f3..021816ce3 100644
--- a/util/m5/m5.c
+++ b/util/m5/m5.c
@@ -135,6 +135,15 @@ do_exit(int argc, char *argv[])
}
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[])
{
uint64_t ints[2];
@@ -273,6 +282,7 @@ struct MainFunc
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]]" },
diff --git a/util/m5/m5op.h b/util/m5/m5op.h
index 9e693258e..9df9a7429 100644
--- a/util/m5/m5op.h
+++ b/util/m5/m5op.h
@@ -47,6 +47,7 @@ uint64_t rpns();
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);
diff --git a/util/m5/m5op_x86.S b/util/m5/m5op_x86.S
index 93eacc24d..2c25785e6 100644
--- a/util/m5/m5op_x86.S
+++ b/util/m5/m5op_x86.S
@@ -48,6 +48,7 @@ TWO_BYTE_OP(quiesceCycle, quiescecycle_func)
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)
diff --git a/util/m5/m5ops.h b/util/m5/m5ops.h
index f08524014..8ff1ac42f 100644
--- a/util/m5/m5ops.h
+++ b/util/m5/m5ops.h
@@ -40,6 +40,7 @@
#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