From fdf9b3e831e8e6b5ceb2a44c742da7d1ab558242 Mon Sep 17 00:00:00 2001 From: bellard Date: Thu, 27 Apr 2006 21:07:38 +0000 Subject: sh4 target (Samuel Tardieu) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1861 c046a42c-6fe2-441c-8c8c-71466251a162 --- linux-user/main.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'linux-user/main.c') diff --git a/linux-user/main.c b/linux-user/main.c index 1f4720516d..78f45a5f9f 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1387,6 +1387,38 @@ void cpu_loop(CPUMIPSState *env) } #endif +#ifdef TARGET_SH4 +void cpu_loop (CPUState *env) +{ + int trapnr, ret; + // target_siginfo_t info; + + while (1) { + trapnr = cpu_sh4_exec (env); + + switch (trapnr) { + case 0x160: + ret = do_syscall(env, + env->gregs[0x13], + env->gregs[0x14], + env->gregs[0x15], + env->gregs[0x16], + env->gregs[0x17], + env->gregs[0x10], + 0); + env->gregs[0x10] = ret; + env->pc += 2; + break; + default: + printf ("Unhandled trap: 0x%x\n", trapnr); + cpu_dump_state(env, stderr, fprintf, 0); + exit (1); + } + process_pending_signals (env); + } +} +#endif + void usage(void) { printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2005 Fabrice Bellard\n" @@ -1665,6 +1697,15 @@ int main(int argc, char **argv) } env->PC = regs->cp0_epc; } +#elif defined(TARGET_SH4) + { + int i; + + for(i = 0; i < 16; i++) { + env->gregs[i] = regs->regs[i]; + } + env->pc = regs->pc; + } #else #error unsupported target CPU #endif -- cgit v1.2.3