提交 b1f9be31 编写于 作者: J j_mayer

Add -cpu option for linux user emulation.

Only usable for PowerPC and ARM for now.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2496 c046a42c-6fe2-441c-8c8c-71466251a162
上级 6c041c54
...@@ -1537,13 +1537,14 @@ void cpu_loop(CPUM68KState *env) ...@@ -1537,13 +1537,14 @@ void cpu_loop(CPUM68KState *env)
void usage(void) void usage(void)
{ {
printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard\n" printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard\n"
"usage: qemu-" TARGET_ARCH " [-h] [-g] [-d opts] [-L path] [-s size] program [arguments...]\n" "usage: qemu-" TARGET_ARCH " [-h] [-g] [-d opts] [-L path] [-s size] [-cpu model] program [arguments...]\n"
"Linux CPU emulator (compiled for %s emulation)\n" "Linux CPU emulator (compiled for %s emulation)\n"
"\n" "\n"
"-h print this help\n" "-h print this help\n"
"-g port wait gdb connection to port\n" "-g port wait gdb connection to port\n"
"-L path set the elf interpreter prefix (default=%s)\n" "-L path set the elf interpreter prefix (default=%s)\n"
"-s size set the stack size in bytes (default=%ld)\n" "-s size set the stack size in bytes (default=%ld)\n"
"-cpu model select CPU (-cpu ? for list)\n"
"\n" "\n"
"debug options:\n" "debug options:\n"
#ifdef USE_CODE_COPY #ifdef USE_CODE_COPY
...@@ -1567,6 +1568,7 @@ TaskState *first_task_state; ...@@ -1567,6 +1568,7 @@ TaskState *first_task_state;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
const char *filename; const char *filename;
const char *cpu_model;
struct target_pt_regs regs1, *regs = &regs1; struct target_pt_regs regs1, *regs = &regs1;
struct image_info info1, *info = &info1; struct image_info info1, *info = &info1;
TaskState ts1, *ts = &ts1; TaskState ts1, *ts = &ts1;
...@@ -1581,6 +1583,7 @@ int main(int argc, char **argv) ...@@ -1581,6 +1583,7 @@ int main(int argc, char **argv)
/* init debug */ /* init debug */
cpu_set_log_filename(DEBUG_LOGFILE); cpu_set_log_filename(DEBUG_LOGFILE);
cpu_model = NULL;
optind = 1; optind = 1;
for(;;) { for(;;) {
if (optind >= argc) if (optind >= argc)
...@@ -1631,6 +1634,18 @@ int main(int argc, char **argv) ...@@ -1631,6 +1634,18 @@ int main(int argc, char **argv)
gdbstub_port = atoi(argv[optind++]); gdbstub_port = atoi(argv[optind++]);
} else if (!strcmp(r, "r")) { } else if (!strcmp(r, "r")) {
qemu_uname_release = argv[optind++]; qemu_uname_release = argv[optind++];
} else if (!strcmp(r, "cpu")) {
cpu_model = argv[optind++];
if (strcmp(cpu_model, "?") == 0) {
#if defined(TARGET_PPC)
ppc_cpu_list(stdout, &fprintf);
#elif defined(TARGET_ARM)
arm_cpu_list();
#elif defined(TARGET_MIPS)
mips_cpu_list(stdout, &fprintf);
#endif
exit(1);
}
} else } else
#ifdef USE_CODE_COPY #ifdef USE_CODE_COPY
if (!strcmp(r, "no-code-copy")) { if (!strcmp(r, "no-code-copy")) {
...@@ -1756,7 +1771,9 @@ int main(int argc, char **argv) ...@@ -1756,7 +1771,9 @@ int main(int argc, char **argv)
#elif defined(TARGET_ARM) #elif defined(TARGET_ARM)
{ {
int i; int i;
cpu_arm_set_model(env, "arm926"); if (cpu_model == NULL)
cpu_model = "arm926";
cpu_arm_set_model(env, cpu_model);
cpsr_write(env, regs->uregs[16], 0xffffffff); cpsr_write(env, regs->uregs[16], 0xffffffff);
for(i = 0; i < 16; i++) { for(i = 0; i < 16; i++) {
env->regs[i] = regs->uregs[i]; env->regs[i] = regs->uregs[i];
...@@ -1783,15 +1800,9 @@ int main(int argc, char **argv) ...@@ -1783,15 +1800,9 @@ int main(int argc, char **argv)
int i; int i;
/* Choose and initialise CPU */ /* Choose and initialise CPU */
/* XXX: CPU model (or PVR) should be provided on command line */ if (cpu_model == NULL)
// ppc_find_by_name("750gx", &def); cpu_model = "750";
// ppc_find_by_name("750fx", &def); ppc_find_by_name(cpu_model, &def);
// ppc_find_by_name("750p", &def);
ppc_find_by_name("750", &def);
// ppc_find_by_name("G3", &def);
// ppc_find_by_name("604r", &def);
// ppc_find_by_name("604e", &def);
// ppc_find_by_name("604", &def);
if (def == NULL) { if (def == NULL) {
cpu_abort(env, cpu_abort(env,
"Unable to find PowerPC CPU definition\n"); "Unable to find PowerPC CPU definition\n");
...@@ -1840,6 +1851,7 @@ int main(int argc, char **argv) ...@@ -1840,6 +1851,7 @@ int main(int argc, char **argv)
{ {
int i; int i;
/* XXX: set CPU model */
for(i = 0; i < 32; i++) { for(i = 0; i < 32; i++) {
env->gpr[i] = regs->regs[i]; env->gpr[i] = regs->regs[i];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册