summaryrefslogtreecommitdiff
path: root/util/m5
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2006-08-17 19:16:03 -0400
committerKevin Lim <ktlim@umich.edu>2006-08-17 19:16:03 -0400
commita21afd7bc45c1d2e571a85dc54649d292fcd8c7f (patch)
tree7716a0f20bc31f264cf5daf5533a99fa644f35b6 /util/m5
parent399c01aceb48c2bc0cc465be1df7e76139c2ca88 (diff)
downloadgem5-a21afd7bc45c1d2e571a85dc54649d292fcd8c7f.tar.xz
Add readfile back in.
--HG-- extra : convert_revision : 0b64f2d95b439b19f1131fe00f45da56617b0026
Diffstat (limited to 'util/m5')
-rw-r--r--util/m5/m5.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/util/m5/m5.c b/util/m5/m5.c
index c9d7d5a47..193c0e329 100644
--- a/util/m5/m5.c
+++ b/util/m5/m5.c
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "m5op.h"
@@ -49,6 +50,7 @@ usage()
" m5 dumpstats [delay [period]]\n"
" m5 dumpresetstats [delay [period]]\n"
" m5 checkpoint [delay [period]]\n"
+ " m5 readfile\n"
"\n"
"All times in nanoseconds!\n");
exit(1);
@@ -184,5 +186,21 @@ main(int argc, char *argv[])
return 0;
}
+ if (COMPARE("readfile")) {
+ char buf[256*1024];
+ int offset = 0;
+ int len;
+
+ if (argc != 2)
+ usage();
+
+ while ((len = m5_readfile(buf, sizeof(buf), offset)) > 0) {
+ write(STDOUT_FILENO, buf, len);
+ offset += len;
+ }
+
+ return 0;
+ }
+
usage();
}