summaryrefslogtreecommitdiff
path: root/linux-user/main.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-09-30 20:57:29 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-09-30 20:57:29 +0000
commit93ac68bca5a3332ffacd7bf10e7b9c4cfdab6374 (patch)
tree75f90d2b022242e53a022846b2d42d7da809cca5 /linux-user/main.c
parent1e43adfc89d2730ab5b24b7a6b5c8ed373b6e284 (diff)
downloadqemu-93ac68bca5a3332ffacd7bf10e7b9c4cfdab6374.tar.gz
sparc emulation target (thanx to Thomas M. Ogrisegg)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@388 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/main.c')
-rw-r--r--linux-user/main.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index f4c936c5bc..811b8bfba8 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1,5 +1,5 @@
/*
- * qemu main
+ * qemu user main
*
* Copyright (c) 2003 Fabrice Bellard
*
@@ -38,7 +38,7 @@ static const char *interp_prefix = CONFIG_QEMU_PREFIX;
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];
@@ -299,10 +299,37 @@ void cpu_loop(CPUARMState *env)
#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"
@@ -497,6 +524,9 @@ int main(int argc, char **argv)
}
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