提交 ce09776b 编写于 作者: B bellard

PowerPC System emulation (Jocelyn Mayer)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@534 c046a42c-6fe2-441c-8c8c-71466251a162
上级 5be1a8e0
...@@ -169,6 +169,8 @@ int cpu_exec(CPUState *env1) ...@@ -169,6 +169,8 @@ int cpu_exec(CPUState *env1)
env->exception_is_int, env->exception_is_int,
env->error_code, env->error_code,
env->exception_next_eip, 0); env->exception_next_eip, 0);
#elif defined(TARGET_PPC)
do_interrupt(env);
#endif #endif
} }
env->exception_index = -1; env->exception_index = -1;
...@@ -201,6 +203,13 @@ int cpu_exec(CPUState *env1) ...@@ -201,6 +203,13 @@ int cpu_exec(CPUState *env1)
T0 = 0; T0 = 0;
#endif #endif
} }
#elif defined(TARGET_PPC)
if ((interrupt_request & CPU_INTERRUPT_HARD)) {
do_queue_exception(EXCP_EXTERNAL);
if (check_exception_state(env))
do_interrupt(env);
env->interrupt_request &= ~CPU_INTERRUPT_HARD;
}
#endif #endif
if (interrupt_request & CPU_INTERRUPT_EXIT) { if (interrupt_request & CPU_INTERRUPT_EXIT) {
env->interrupt_request &= ~CPU_INTERRUPT_EXIT; env->interrupt_request &= ~CPU_INTERRUPT_EXIT;
...@@ -250,7 +259,7 @@ int cpu_exec(CPUState *env1) ...@@ -250,7 +259,7 @@ int cpu_exec(CPUState *env1)
pc = (uint8_t *)env->regs[15]; pc = (uint8_t *)env->regs[15];
#elif defined(TARGET_SPARC) #elif defined(TARGET_SPARC)
flags = 0; flags = 0;
cs_base = env->npc; cs_base = (uint8_t *)env->npc;
pc = (uint8_t *) env->pc; pc = (uint8_t *) env->pc;
#elif defined(TARGET_PPC) #elif defined(TARGET_PPC)
flags = 0; flags = 0;
...@@ -571,8 +580,9 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, ...@@ -571,8 +580,9 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
int is_write, sigset_t *old_set) int is_write, sigset_t *old_set)
{ {
TranslationBlock *tb; TranslationBlock *tb;
int ret;
#if 0 #if 1
if (cpu_single_env) if (cpu_single_env)
env = cpu_single_env; /* XXX: find a correct solution for multithread */ env = cpu_single_env; /* XXX: find a correct solution for multithread */
#endif #endif
...@@ -585,6 +595,13 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, ...@@ -585,6 +595,13 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
return 1; return 1;
} }
/* see if it is an MMU fault */
ret = cpu_ppc_handle_mmu_fault(env, address, is_write | ACCESS_INT, msr_pr, 0);
if (ret < 0)
return 0; /* not an MMU fault */
if (ret == 0)
return 1; /* the MMU fault was handled without causing real CPU fault */
/* now we have a real cpu fault */ /* now we have a real cpu fault */
tb = tb_find_pc(pc); tb = tb_find_pc(pc);
if (tb) { if (tb) {
...@@ -592,14 +609,20 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, ...@@ -592,14 +609,20 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
a virtual CPU fault */ a virtual CPU fault */
cpu_restore_state(tb, env, pc); cpu_restore_state(tb, env, pc);
} }
if (ret == 1) {
#if 0 #if 0
printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", printf("PF exception: NIP=0x%08x error=0x%x %p\n",
env->eip, env->cr[2], env->error_code); env->nip, env->error_code, tb);
#endif #endif
/* we restore the process signal mask as the sigreturn should /* we restore the process signal mask as the sigreturn should
do it (XXX: use sigsetjmp) */ do it (XXX: use sigsetjmp) */
sigprocmask(SIG_SETMASK, old_set, NULL); sigprocmask(SIG_SETMASK, old_set, NULL);
raise_exception_err(EXCP_PROGRAM, env->error_code); do_queue_exception_err(env->exception_index, env->error_code);
} else {
/* activate soft MMU for this block */
sigprocmask(SIG_SETMASK, old_set, NULL);
cpu_loop_exit();
}
/* never comes here */ /* never comes here */
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册