changeset 54423643dd88 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=54423643dd88
description:
        ARM: fix m5 op binary to properly convert 64bit operands

diffstat:

 util/m5/m5.c |  17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r 3e5761bfa300 -r 54423643dd88 util/m5/m5.c
--- a/util/m5/m5.c      Fri Sep 07 14:20:53 2012 -0500
+++ b/util/m5/m5.c      Fri Sep 07 14:20:53 2012 -0500
@@ -65,9 +65,17 @@
     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 @@
     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 @@
     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);
 }
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to