diff options
Diffstat (limited to 'darwin-user/main.c')
-rw-r--r-- | darwin-user/main.c | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/darwin-user/main.c b/darwin-user/main.c index d0de491e0..10b7fcb9a 100644 --- a/darwin-user/main.c +++ b/darwin-user/main.c @@ -224,11 +224,6 @@ void cpu_loop(CPUPPCState *env) case POWERPC_EXCP_FP: EXCP_DUMP(env, "Floating point program exception\n"); /* Set FX */ - env->fpscr[7] |= 0x8; - /* Finally, update FEX */ - if ((((env->fpscr[7] & 0x3) << 3) | (env->fpscr[6] >> 1)) & - ((env->fpscr[1] << 1) | (env->fpscr[0] >> 3))) - env->fpscr[7] |= 0x4; info.si_signo = SIGFPE; info.si_errno = 0; switch (env->error_code & 0xF) { @@ -248,7 +243,7 @@ void cpu_loop(CPUPPCState *env) case POWERPC_EXCP_FP_VXSOFT: info.si_code = FPE_FLTINV; break; - case POWERPC_EXCP_FP_VXNAN: + case POWERPC_EXCP_FP_VXSNAN: case POWERPC_EXCP_FP_VXISI: case POWERPC_EXCP_FP_VXIDI: case POWERPC_EXCP_FP_VXIMZ: @@ -362,7 +357,6 @@ void cpu_loop(CPUPPCState *env) case POWERPC_EXCP_DEBUG: /* Debug interrupt */ gdb_handlesig (env, SIGTRAP); break; -#if defined(TARGET_PPCEMB) case POWERPC_EXCP_SPEU: /* SPE/embedded floating-point unavail. */ EXCP_DUMP(env, "No SPE/floating-point instruction allowed\n"); info.si_signo = SIGILL; @@ -388,12 +382,10 @@ void cpu_loop(CPUPPCState *env) cpu_abort(env, "Doorbell critical interrupt while in user mode. " "Aborting\n"); break; -#endif /* defined(TARGET_PPCEMB) */ case POWERPC_EXCP_RESET: /* System reset exception */ cpu_abort(env, "Reset interrupt while in user mode. " "Aborting\n"); break; -#if defined(TARGET_PPC64) /* PowerPC 64 */ case POWERPC_EXCP_DSEG: /* Data segment exception */ cpu_abort(env, "Data segment exception while in user mode. " "Aborting\n"); @@ -402,19 +394,15 @@ void cpu_loop(CPUPPCState *env) cpu_abort(env, "Instruction segment exception " "while in user mode. Aborting\n"); break; -#endif /* defined(TARGET_PPC64) */ -#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */ case POWERPC_EXCP_HDECR: /* Hypervisor decrementer exception */ cpu_abort(env, "Hypervisor decrementer interrupt " "while in user mode. Aborting\n"); break; -#endif /* defined(TARGET_PPC64H) */ case POWERPC_EXCP_TRACE: /* Trace exception */ /* Nothing to do: * we use this exception to emulate step-by-step execution mode. */ break; -#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */ case POWERPC_EXCP_HDSI: /* Hypervisor data storage exception */ cpu_abort(env, "Hypervisor data storage exception " "while in user mode. Aborting\n"); @@ -431,7 +419,6 @@ void cpu_loop(CPUPPCState *env) cpu_abort(env, "Hypervisor instruction segment exception " "while in user mode. Aborting\n"); break; -#endif /* defined(TARGET_PPC64H) */ case POWERPC_EXCP_VPU: /* Vector unavailable exception */ EXCP_DUMP(env, "No Altivec instructions allowed\n"); info.si_signo = SIGILL; @@ -762,9 +749,6 @@ void usage(void) "-s size set the stack size in bytes (default=%ld)\n" "\n" "debug options:\n" -#ifdef USE_CODE_COPY - "-no-code-copy disable code copy acceleration\n" -#endif "-d options activate log (logfile='%s')\n" "-g wait for gdb on port 1234\n" "-p pagesize set the host page size to 'pagesize'\n", @@ -793,6 +777,7 @@ int main(int argc, char **argv) int optind; short use_gdbstub = 0; const char *r; + const char *cpu_model; if (argc <= 1) usage(); @@ -849,12 +834,16 @@ int main(int argc, char **argv) } else if (!strcmp(r, "g")) { use_gdbstub = 1; - } else -#ifdef USE_CODE_COPY - if (!strcmp(r, "no-code-copy")) { - code_copy_enabled = 0; - } else + } else if (!strcmp(r, "cpu")) { + cpu_model = argv[optind++]; + if (strcmp(cpu_model, "?") == 0) { +/* XXX: implement xxx_cpu_list for targets that still miss it */ +#if defined(cpu_list) + cpu_list(stdout, &fprintf); #endif + _exit(1); + } + } else { usage(); } @@ -866,9 +855,27 @@ int main(int argc, char **argv) /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs)); + if (cpu_model == NULL) { +#if defined(TARGET_I386) +#ifdef TARGET_X86_64 + cpu_model = "qemu64"; +#else + cpu_model = "qemu32"; +#endif +#elif defined(TARGET_PPC) +#ifdef TARGET_PPC64 + cpu_model = "970"; +#else + cpu_model = "750"; +#endif +#else +#error unsupported CPU +#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); printf("Starting %s with qemu\n----------------\n", filename); @@ -1009,6 +1016,14 @@ int main(int argc, char **argv) #elif defined(TARGET_PPC) { int i; + +#if defined(TARGET_PPC64) +#if defined(TARGET_ABI32) + env->msr &= ~((target_ulong)1 << MSR_SF); +#else + env->msr |= (target_ulong)1 << MSR_SF; +#endif +#endif env->nip = regs->nip; for(i = 0; i < 32; i++) { env->gpr[i] = regs->gpr[i]; |