int main (int argc, char *const argv[]) { parser_result_t *config; config = try_input(argc, argv); run_flags = config->flags; memory_load(config); cpu_run(config->ninst, config->pc); cpu_status(); if (run_flags & FLAG_WATCHMEM) show_interval_memory(config->watch_begin, config->watch_end); return 0; }
int cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned long cpuid; if (argc < 3) { cmd_usage(cmdtp); return 1; } cpuid = simple_strtoul(argv[1], NULL, 10); if (cpuid >= cpu_numcores()) { printf ("Core num: %lu is out of range[0..%d]\n", cpuid, cpu_numcores() - 1); return 1; } if (argc == 3) { if (strncmp(argv[2], "reset", 5) == 0) { cpu_reset(cpuid); } else if (strncmp(argv[2], "status", 6) == 0) { cpu_status(cpuid); } else if (strncmp(argv[2], "disable", 7) == 0) { return cpu_disable(cpuid); } else { cmd_usage(cmdtp); return 1; } return 0; } /* 4 or greater, make sure its release */ if (strncmp(argv[2], "release", 7) != 0) { cmd_usage(cmdtp); return 1; } if (cpu_release(cpuid, argc - 3, argv + 3)) { cmd_usage(cmdtp); return 1; } return 0; }
int cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { unsigned long cpuid; if (argc < 3) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } cpuid = simple_strtoul(argv[1], NULL, 10); if (cpuid >= CONFIG_NR_CPUS) { printf ("Core num: %lu is out of range[0..%d]\n", cpuid, CONFIG_NR_CPUS - 1); return 1; } if (argc == 3) { if (strncmp(argv[2], "reset", 5) == 0) { cpu_reset(cpuid); } else if (strncmp(argv[2], "status", 6) == 0) { cpu_status(cpuid); } else { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } return 0; } /* 4 or greater, make sure its release */ if (strncmp(argv[2], "release", 7) != 0) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } if (cpu_release(cpuid, argc - 3, argv + 3)) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } return 0; }