From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AM1SC-0000ko-De for qemu-devel@nongnu.org; Tue, 18 Nov 2003 03:43:20 -0500 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AM1Ra-0000Ct-3l for qemu-devel@nongnu.org; Tue, 18 Nov 2003 03:43:13 -0500 Received: from [62.210.158.45] (helo=quito.magic.fr) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AM1RZ-0000Am-22 for qemu-devel@nongnu.org; Tue, 18 Nov 2003 03:42:41 -0500 Received: from 10.0.0.2 (ppp-181.net-555.magic.fr [62.210.255.181]) by quito.magic.fr (8.11.6/8.11.2) with ESMTP id hAI7fBW25240 for ; Tue, 18 Nov 2003 08:41:11 +0100 (CET) Subject: Re: [Qemu-devel] [ADD] PPC processor emulation From: "J. Mayer" In-Reply-To: <1069140512.14646.2174.camel@rapid> References: <20031117105133.7e856e56.Jens.Arm@gmx.de> <1069140512.14646.2174.camel@rapid> Content-Type: text/plain Message-Id: <1069141557.13659.2212.camel@rapid> Mime-Version: 1.0 Date: 18 Nov 2003 08:45:57 +0100 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org cpu-exec.c.diff Add PPC target diff -urNbB -x CVS qemu-current/cpu-exec.c qemu/cpu-exec.c --- qemu-current/cpu-exec.c Tue Nov 18 06:51:06 2003 +++ qemu/cpu-exec.c Sun Nov 16 04:09:07 2003 @@ -131,6 +131,7 @@ env->cpsr = psr & ~0xf0000000; } #elif defined(TARGET_SPARC) +#elif defined(TARGET_PPC) #else #error unsupported target CPU #endif @@ -226,6 +227,8 @@ env->cpsr &= ~0xf0000000; #elif defined(TARGET_SPARC) cpu_sparc_dump_state (env, logfile, 0); +#elif defined(TARGET_PPC) + cpu_ppc_dump_state(env, logfile, 0); #else #error unsupported target CPU #endif @@ -251,6 +254,10 @@ env->npc = 0; } pc = (uint8_t *) env->pc; +#elif defined(TARGET_PPC) + flags = 0; + cs_base = 0; + pc = (uint8_t *)env->nip; #else #error unsupported CPU #endif @@ -365,6 +372,7 @@ #elif defined(TARGET_ARM) env->cpsr = compute_cpsr(); #elif defined(TARGET_SPARC) +#elif defined(TARGET_PPC) #else #error unsupported target CPU #endif @@ -501,6 +509,43 @@ int is_write, sigset_t *old_set) { return 0; +} +#elif defined (TARGET_PPC) +static inline int handle_cpu_signal(unsigned long pc, unsigned long address, + int is_write, sigset_t *old_set) +{ + TranslationBlock *tb; + +#if 0 + if (cpu_single_env) + env = cpu_single_env; /* XXX: find a correct solution for multithread */ +#endif +#if defined(DEBUG_SIGNAL) + printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", + pc, address, is_write, *(unsigned long *)old_set); +#endif + /* XXX: locking issue */ + if (is_write && page_unprotect(address)) { + return 1; + } + + /* now we have a real cpu fault */ + tb = tb_find_pc(pc); + if (tb) { + /* the PC is inside the translated code. It means that we have + a virtual CPU fault */ + cpu_restore_state(tb, env, pc); + } +#if 0 + printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", + env->eip, env->cr[2], env->error_code); +#endif + /* we restore the process signal mask as the sigreturn should + do it (XXX: use sigsetjmp) */ + sigprocmask(SIG_SETMASK, old_set, NULL); + raise_exception_err(EXCP_PROGRAM, env->error_code); + /* never comes here */ + return 1; } #else #error unsupported target CPU