aboutsummaryrefslogtreecommitdiff
path: root/linux-user/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/main.c')
-rw-r--r--linux-user/main.c85
1 files changed, 27 insertions, 58 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 77667a55e2..18e509d082 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1970,26 +1970,42 @@ int main(int argc, char **argv)
/* Scan interp_prefix dir for replacement files. */
init_paths(interp_prefix);
-#if defined(TARGET_I386)
- /* must be done before cpu_init() for x86 XXX: suppress this hack
- by adding a new parameter to cpu_init and by suppressing
- cpu_xxx_register() */
if (cpu_model == NULL) {
+#if defined(TARGET_I386)
#ifdef TARGET_X86_64
cpu_model = "qemu64";
#else
cpu_model = "qemu32";
#endif
- }
- if (x86_find_cpu_by_name(cpu_model)) {
- fprintf(stderr, "Unable to find x86 CPU definition\n");
- exit(1);
- }
+#elif defined(TARGET_ARM)
+ cpu_model = "arm926";
+#elif defined(TARGET_M68K)
+ cpu_model = "any";
+#elif defined(TARGET_SPARC)
+#ifdef TARGET_SPARC64
+ cpu_model = "TI UltraSparc II";
+#else
+ cpu_model = "Fujitsu MB86904";
#endif
-
+#elif defined(TARGET_MIPS)
+#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
+ cpu_model = "20Kc";
+#else
+ cpu_model = "24Kf";
+#endif
+#elif defined(TARGET_PPC)
+ cpu_model = "750";
+#else
+ cpu_model = "any";
+#endif
+ }
/* NOTE: we need to init the CPU at this stage to get
qemu_host_page_size */
- env = cpu_init();
+ env = cpu_init(cpu_model);
+ if (!env) {
+ fprintf(stderr, "Unable to find CPU definition\n");
+ exit(1);
+ }
global_env = env;
if(getenv("QEMU_STRACE") ){
@@ -2130,9 +2146,6 @@ int main(int argc, char **argv)
#elif defined(TARGET_ARM)
{
int i;
- if (cpu_model == NULL)
- cpu_model = "arm926";
- cpu_arm_set_model(env, cpu_model);
cpsr_write(env, regs->uregs[16], 0xffffffff);
for(i = 0; i < 16; i++) {
env->regs[i] = regs->uregs[i];
@@ -2141,20 +2154,6 @@ int main(int argc, char **argv)
#elif defined(TARGET_SPARC)
{
int i;
- const sparc_def_t *def;
-#ifdef TARGET_SPARC64
- if (cpu_model == NULL)
- cpu_model = "TI UltraSparc II";
-#else
- if (cpu_model == NULL)
- cpu_model = "Fujitsu MB86904";
-#endif
- sparc_find_by_name(cpu_model, &def);
- if (def == NULL) {
- fprintf(stderr, "Unable to find Sparc CPU definition\n");
- exit(1);
- }
- cpu_sparc_register(env, def, 0);
env->pc = regs->pc;
env->npc = regs->npc;
env->y = regs->y;
@@ -2165,19 +2164,8 @@ int main(int argc, char **argv)
}
#elif defined(TARGET_PPC)
{
- ppc_def_t *def;
int i;
- /* Choose and initialise CPU */
- if (cpu_model == NULL)
- cpu_model = "750";
- ppc_find_by_name(cpu_model, &def);
- if (def == NULL) {
- cpu_abort(env,
- "Unable to find PowerPC CPU definition\n");
- }
- cpu_ppc_register(env, def);
- cpu_ppc_reset(env);
#if defined(TARGET_PPC64)
#if defined(TARGET_ABI32)
env->msr &= ~((target_ulong)1 << MSR_SF);
@@ -2192,12 +2180,6 @@ int main(int argc, char **argv)
}
#elif defined(TARGET_M68K)
{
- if (cpu_model == NULL)
- cpu_model = "any";
- if (cpu_m68k_set_model(env, cpu_model)) {
- cpu_abort(cpu_single_env,
- "Unable to find m68k CPU definition\n");
- }
env->pc = regs->pc;
env->dregs[0] = regs->d0;
env->dregs[1] = regs->d1;
@@ -2220,21 +2202,8 @@ int main(int argc, char **argv)
}
#elif defined(TARGET_MIPS)
{
- mips_def_t *def;
int i;
- /* Choose and initialise CPU */
- if (cpu_model == NULL)
-#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
- cpu_model = "20Kc";
-#else
- cpu_model = "24Kf";
-#endif
- mips_find_by_name(cpu_model, &def);
- if (def == NULL)
- cpu_abort(env, "Unable to find MIPS CPU definition\n");
- cpu_mips_register(env, def);
-
for(i = 0; i < 32; i++) {
env->gpr[i][env->current_tc] = regs->regs[i];
}