ARM: fix m5 op binary to properly convert 64bit operands
This commit is contained in:
parent
25c1933ffe
commit
0ecb351c51
1 changed files with 14 additions and 3 deletions
17
util/m5/m5.c
17
util/m5/m5.c
|
@ -65,9 +65,17 @@ parse_int_args(int argc, char *argv[], uint64_t ints[], int len)
|
||||||
if (argc > len)
|
if (argc > len)
|
||||||
usage();
|
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;
|
int i;
|
||||||
for (i = 0; i < len; ++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
|
int
|
||||||
|
@ -121,7 +129,9 @@ do_exit(int argc, char *argv[])
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
usage();
|
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
|
void
|
||||||
|
@ -223,7 +233,8 @@ do_sw99param(int argc, char *argv[])
|
||||||
uint64_t param = m5_initparam();
|
uint64_t param = m5_initparam();
|
||||||
|
|
||||||
// run-time, rampup-time, rampdown-time, warmup-time, connections
|
// 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 >> 36) & 0xfff, (param >> 24) & 0xfff,
|
||||||
(param >> 12) & 0xfff, (param >> 0) & 0xfff);
|
(param >> 12) & 0xfff, (param >> 0) & 0xfff);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue