summaryrefslogtreecommitdiff
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-11-23 17:05:30 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-11-23 17:05:30 +0000
commit678673089d1ba7cd0f2960a2815a0d5bb8a72fa3 (patch)
treea1c8fa862f3da0189e71fd866f5e5717f60caa70 /cpu-exec.c
parent28b6751f30603a4c7146282fde9efcf8b5f31f7b (diff)
downloadqemu-678673089d1ba7cd0f2960a2815a0d5bb8a72fa3.tar.gz
qemu-678673089d1ba7cd0f2960a2815a0d5bb8a72fa3.tar.bz2
qemu-678673089d1ba7cd0f2960a2815a0d5bb8a72fa3.zip
PowerPC target support (Jocelyn Mayer) - added better support for uid16
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@474 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c59
1 files changed, 52 insertions, 7 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 5bbace345f..5507c04dd0 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -133,6 +133,7 @@ int cpu_exec(CPUState *env1)
env->cpsr = psr & ~0xf0000000;
}
#elif defined(TARGET_SPARC)
+#elif defined(TARGET_PPC)
#else
#error unsupported target CPU
#endif
@@ -228,6 +229,8 @@ int cpu_exec(CPUState *env1)
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
@@ -246,13 +249,17 @@ int cpu_exec(CPUState *env1)
cs_base = 0;
pc = (uint8_t *)env->regs[15];
#elif defined(TARGET_SPARC)
- flags = 0;
- cs_base = 0;
- if (env->npc) {
- env->pc = env->npc;
- env->npc = 0;
- }
- pc = (uint8_t *) env->pc;
+ flags = 0;
+ cs_base = 0;
+ if (env->npc) {
+ env->pc = env->npc;
+ 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
@@ -376,6 +383,7 @@ int cpu_exec(CPUState *env1)
#elif defined(TARGET_ARM)
env->cpsr = compute_cpsr();
#elif defined(TARGET_SPARC)
+#elif defined(TARGET_PPC)
#else
#error unsupported target CPU
#endif
@@ -513,6 +521,43 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
{
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
#endif