/*
- * qemu main
+ * qemu user main
*
* Copyright (c) 2003 Fabrice Bellard
*
#include "qemu.h"
-#include "cpu-i386.h"
-
#define DEBUG_LOGFILE "/tmp/qemu.log"
FILE *logfile = NULL;
const char interp[] __attribute__((section(".interp"))) = "/lib/ld-linux.so.2";
#endif
-/* for recent libc, we add these dummies symbol which are not declared
+/* for recent libc, we add these dummy symbols which are not declared
when generating a linked object (bug in ld ?) */
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
long __init_array_start[0];
#ifdef TARGET_ARM
-#define ARM_SYSCALL_BASE 0x900000
-
void cpu_loop(CPUARMState *env)
{
int trapnr;
}
}
break;
+ case EXCP_INTERRUPT:
+ /* just indicate that signals should be handled asap */
+ break;
default:
error:
fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
#endif
+#ifdef TARGET_SPARC
+
+void cpu_loop (CPUSPARCState *env)
+{
+ int trapnr;
+
+ while (1) {
+ trapnr = cpu_sparc_exec (env);
+
+ switch (trapnr) {
+ case 0x8: case 0x10:
+ env->regwptr[0] = do_syscall (env, env->gregs[1],
+ env->regwptr[0], env->regwptr[1], env->regwptr[2],
+ env->regwptr[3], env->regwptr[4], env->regwptr[13]);
+ if (env->regwptr[0] >= 0xffffffe0)
+ env->psr |= PSR_CARRY;
+ break;
+ default:
+ printf ("Invalid trap: %d\n", trapnr);
+ exit (1);
+ }
+ process_pending_signals (env);
+ }
+}
+
+#endif
+
void usage(void)
{
- printf("qemu version " QEMU_VERSION ", Copyright (c) 2003 Fabrice Bellard\n"
- "usage: qemu [-h] [-d] [-L path] [-s size] program [arguments...]\n"
+ printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003 Fabrice Bellard\n"
+ "usage: qemu-" TARGET_ARCH " [-h] [-d] [-L path] [-s size] program [arguments...]\n"
"Linux CPU emulator (compiled for %s emulation)\n"
"\n"
"-h print this help\n"
/* XXX: currently only used for async signals (see signal.c) */
CPUState *global_env;
+/* used only if single thread */
+CPUState *cpu_single_env = NULL;
+
/* used to free thread contexts */
TaskState *first_task_state;
memset(ts, 0, sizeof(TaskState));
env->opaque = ts;
ts->used = 1;
+ env->user_mode_only = 1;
#if defined(TARGET_I386)
+ cpu_x86_set_cpl(env, 3);
+
+ env->cr[0] = CR0_PG_MASK | CR0_WP_MASK | CR0_PE_MASK;
+
/* linux register setup */
env->regs[R_EAX] = regs->eax;
env->regs[R_EBX] = regs->ebx;
cpu_x86_load_seg(env, R_SS, __USER_DS);
cpu_x86_load_seg(env, R_FS, __USER_DS);
cpu_x86_load_seg(env, R_GS, __USER_DS);
- env->user_mode_only = 1;
#elif defined(TARGET_ARM)
{
}
env->cpsr = regs->uregs[16];
}
+#elif defined(TARGET_SPARC)
+ env->pc = regs->u_regs[0];
+ env->regwptr[6] = regs->u_regs[1]-0x40;
#else
#error unsupported target CPU
#endif