summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAli Saidi <Ali.Saidi@ARM.com>2012-09-07 14:20:53 -0500
committerAli Saidi <Ali.Saidi@ARM.com>2012-09-07 14:20:53 -0500
commit0ecb351c5121ff59541a98ba9756adb134495ce7 (patch)
treed70fd56b901f60ecea6a0ff059986fdb6e29e5db /util
parent25c1933ffe7943b057056f9c9822001443ceb4e8 (diff)
downloadgem5-0ecb351c5121ff59541a98ba9756adb134495ce7.tar.xz
ARM: fix m5 op binary to properly convert 64bit operands
Diffstat (limited to 'util')
-rw-r--r--util/m5/m5.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/util/m5/m5.c b/util/m5/m5.c
index a0ce9b3ec..53ac0fba8 100644
--- a/util/m5/m5.c
+++ b/util/m5/m5.c
@@ -65,9 +65,17 @@ parse_int_args(int argc, char *argv[], uint64_t ints[], int len)
if (argc > len)
usage();
+// On 32 bit platforms we need to use strtoull to do the conversion
+#ifdef __LP64__
+#define strto64 strtoul
+#else
+#define strto64 strtoull
+#endif
int i;
for (i = 0; i < len; ++i)
- ints[i] = (i < argc) ? strtoul(argv[i], NULL, 0) : 0;
+ ints[i] = (i < argc) ? strto64(argv[i], NULL, 0) : 0;
+
+#undef strto64
}
int
@@ -121,7 +129,9 @@ do_exit(int argc, char *argv[])
if (argc > 1)
usage();
- m5_exit((argc > 0) ? strtoul(argv[0], NULL, 0) : 0);
+ uint64_t ints[1];
+ parse_int_args(argc, argv, ints, 2);
+ m5_exit(ints[0]);
}
void
@@ -223,7 +233,8 @@ do_sw99param(int argc, char *argv[])
uint64_t param = m5_initparam();
// run-time, rampup-time, rampdown-time, warmup-time, connections
- printf("%d %d %d %d %d", (param >> 48) & 0xfff,
+ printf("%"PRId64" %"PRId64" %"PRId64" %"PRId64" %"PRId64,
+ (param >> 48) & 0xfff,
(param >> 36) & 0xfff, (param >> 24) & 0xfff,
(param >> 12) & 0xfff, (param >> 0) & 0xfff);
}