From 195f96ab4f10d69343ee6b7a1c1b2155af89608b Mon Sep 17 00:00:00 2001 From: Alastair Reid Date: Wed, 27 Jun 2018 14:39:09 +0100 Subject: RTS: Delete __SetConfig stub function This is now directly supported from SAIL so we can call the SAIL __SetConfig function instead. --- lib/rts.c | 41 +++++++++++------------------------------ lib/rts.h | 2 ++ 2 files changed, 13 insertions(+), 30 deletions(-) (limited to 'lib') diff --git a/lib/rts.c b/lib/rts.c index e4f72b6f..0c20d40f 100644 --- a/lib/rts.c +++ b/lib/rts.c @@ -369,17 +369,6 @@ static struct option options[] = { {0, 0, 0, 0} }; -void z__SetConfig(char* arg, char* value) -{ - fprintf(stderr, "Warning: ignoring option -C %s=%s\n", arg, value); -} - -void z__ListConfig() -{ - fprintf(stderr, "Unable to list configuration options\n"); -} - - int process_arguments(int argc, char *argv[]) { int c; @@ -395,28 +384,20 @@ int process_arguments(int argc, char *argv[]) switch (c) { case 'C': { char arg[100]; - char value[100]; - if (!sscanf(optarg, "%99[a-zA-Z0-9_.]=%99s", arg, value)) { + uint64_t value; + if (sscanf(optarg, "%99[a-zA-Z0-9_-.]=%" PRId64, arg, &value)) { + // do nothing + } else if (sscanf(optarg, "%99[a-zA-Z0-9_.]=0x%" PRIx64, arg, &value)) { + // do nothing + } else { fprintf(stderr, "Could not parse argument %s\n", optarg); - z__ListConfig(); + // z__ListConfig(); return -1; }; - -#ifndef NO_AARCH64 - // Vile AArch64-specific hack to read the start address from standard - // command line option. This will not be needed once the official - // __SetConfig function is used. - if (strcmp(arg, "cpu.cpu0.RVBAR") == 0) { - if (!sscanf(value, "0x%" PRIx64, &elf_entry)) { - fprintf(stderr, "Could not parse RVBAR address %s\n", value); - exit(1); - } - elf_entry_set = true; - break; - } -#endif - - z__SetConfig(arg, value); + mpz_t s_value; + mpz_init_set_ui(s_value, value); + z__SetConfig(arg, s_value); + mpz_clear(s_value); } break; diff --git a/lib/rts.h b/lib/rts.h index 59833d5a..95425d06 100644 --- a/lib/rts.h +++ b/lib/rts.h @@ -126,3 +126,5 @@ int process_arguments(int, char**); */ void setup_rts(void); void cleanup_rts(void); + +unit z__SetConfig(sail_string, sail_int); -- cgit v1.2.3