version 1.1.1.2, 2018/04/24 16:38:19
|
version 1.1.1.3, 2018/04/24 16:40:34
|
Line 169 static inline TranslationBlock *tb_find_
|
Line 169 static inline TranslationBlock *tb_find_
|
| (env->vfp.vec_stride << 4); |
| (env->vfp.vec_stride << 4); |
if ((env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR) |
if ((env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR) |
flags |= (1 << 6); |
flags |= (1 << 6); |
|
if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)) |
|
flags |= (1 << 7); |
cs_base = 0; |
cs_base = 0; |
pc = env->regs[15]; |
pc = env->regs[15]; |
#elif defined(TARGET_SPARC) |
#elif defined(TARGET_SPARC) |
Line 185 static inline TranslationBlock *tb_find_
|
Line 187 static inline TranslationBlock *tb_find_
|
cs_base = 0; |
cs_base = 0; |
pc = env->nip; |
pc = env->nip; |
#elif defined(TARGET_MIPS) |
#elif defined(TARGET_MIPS) |
flags = env->hflags & (MIPS_HFLAGS_TMASK | MIPS_HFLAG_BMASK); |
flags = env->hflags & (MIPS_HFLAG_TMASK | MIPS_HFLAG_BMASK); |
cs_base = 0; |
cs_base = 0; |
pc = env->PC; |
pc = env->PC; |
|
#elif defined(TARGET_SH4) |
|
flags = env->sr & (SR_MD | SR_RB); |
|
cs_base = 0; /* XXXXX */ |
|
pc = env->pc; |
#else |
#else |
#error unsupported CPU |
#error unsupported CPU |
#endif |
#endif |
Line 361 int cpu_exec(CPUState *env1)
|
Line 367 int cpu_exec(CPUState *env1)
|
#endif |
#endif |
#elif defined(TARGET_PPC) |
#elif defined(TARGET_PPC) |
#elif defined(TARGET_MIPS) |
#elif defined(TARGET_MIPS) |
|
#elif defined(TARGET_SH4) |
|
/* XXXXX */ |
#else |
#else |
#error unsupported target CPU |
#error unsupported target CPU |
#endif |
#endif |
Line 405 int cpu_exec(CPUState *env1)
|
Line 413 int cpu_exec(CPUState *env1)
|
do_interrupt(env->exception_index); |
do_interrupt(env->exception_index); |
#elif defined(TARGET_ARM) |
#elif defined(TARGET_ARM) |
do_interrupt(env); |
do_interrupt(env); |
|
#elif defined(TARGET_SH4) |
|
do_interrupt(env); |
#endif |
#endif |
} |
} |
env->exception_index = -1; |
env->exception_index = -1; |
Line 548 int cpu_exec(CPUState *env1)
|
Line 558 int cpu_exec(CPUState *env1)
|
env->exception_index = EXCP_IRQ; |
env->exception_index = EXCP_IRQ; |
do_interrupt(env); |
do_interrupt(env); |
} |
} |
|
#elif defined(TARGET_SH4) |
|
/* XXXXX */ |
#endif |
#endif |
if (env->interrupt_request & CPU_INTERRUPT_EXITTB) { |
if (env->interrupt_request & CPU_INTERRUPT_EXITTB) { |
env->interrupt_request &= ~CPU_INTERRUPT_EXITTB; |
env->interrupt_request &= ~CPU_INTERRUPT_EXITTB; |
Line 606 int cpu_exec(CPUState *env1)
|
Line 618 int cpu_exec(CPUState *env1)
|
cpu_dump_state(env, logfile, fprintf, 0); |
cpu_dump_state(env, logfile, fprintf, 0); |
#elif defined(TARGET_MIPS) |
#elif defined(TARGET_MIPS) |
cpu_dump_state(env, logfile, fprintf, 0); |
cpu_dump_state(env, logfile, fprintf, 0); |
|
#elif defined(TARGET_SH4) |
|
cpu_dump_state(env, logfile, fprintf, 0); |
#else |
#else |
#error unsupported target CPU |
#error unsupported target CPU |
#endif |
#endif |
Line 627 int cpu_exec(CPUState *env1)
|
Line 641 int cpu_exec(CPUState *env1)
|
jump. */ |
jump. */ |
{ |
{ |
if (T0 != 0 && |
if (T0 != 0 && |
|
#if USE_KQEMU |
|
(env->kqemu_enabled != 2) && |
|
#endif |
tb->page_addr[1] == -1 |
tb->page_addr[1] == -1 |
#if defined(TARGET_I386) && defined(USE_CODE_COPY) |
#if defined(TARGET_I386) && defined(USE_CODE_COPY) |
&& (tb->cflags & CF_CODE_COPY) == |
&& (tb->cflags & CF_CODE_COPY) == |
Line 756 int cpu_exec(CPUState *env1)
|
Line 773 int cpu_exec(CPUState *env1)
|
T0 = 0; |
T0 = 0; |
} |
} |
#endif |
#endif |
|
#if defined(USE_KQEMU) |
|
#define MIN_CYCLE_BEFORE_SWITCH (100 * 1000) |
|
if (kqemu_is_ok(env) && |
|
(cpu_get_time_fast() - env->last_io_time) >= MIN_CYCLE_BEFORE_SWITCH) { |
|
cpu_loop_exit(); |
|
} |
|
#endif |
} |
} |
} else { |
} else { |
env_to_regs(); |
env_to_regs(); |
Line 805 int cpu_exec(CPUState *env1)
|
Line 829 int cpu_exec(CPUState *env1)
|
#endif |
#endif |
#elif defined(TARGET_PPC) |
#elif defined(TARGET_PPC) |
#elif defined(TARGET_MIPS) |
#elif defined(TARGET_MIPS) |
|
#elif defined(TARGET_SH4) |
|
/* XXXXX */ |
#else |
#else |
#error unsupported target CPU |
#error unsupported target CPU |
#endif |
#endif |
Line 901 static inline int handle_cpu_signal(unsi
|
Line 927 static inline int handle_cpu_signal(unsi
|
pc, address, is_write, *(unsigned long *)old_set); |
pc, address, is_write, *(unsigned long *)old_set); |
#endif |
#endif |
/* XXX: locking issue */ |
/* XXX: locking issue */ |
if (is_write && page_unprotect(address, pc, puc)) { |
if (is_write && page_unprotect(h2g(address), pc, puc)) { |
return 1; |
return 1; |
} |
} |
|
|
Line 952 static inline int handle_cpu_signal(unsi
|
Line 978 static inline int handle_cpu_signal(unsi
|
pc, address, is_write, *(unsigned long *)old_set); |
pc, address, is_write, *(unsigned long *)old_set); |
#endif |
#endif |
/* XXX: locking issue */ |
/* XXX: locking issue */ |
if (is_write && page_unprotect(address, pc, puc)) { |
if (is_write && page_unprotect(h2g(address), pc, puc)) { |
return 1; |
return 1; |
} |
} |
/* see if it is an MMU fault */ |
/* see if it is an MMU fault */ |
Line 988 static inline int handle_cpu_signal(unsi
|
Line 1014 static inline int handle_cpu_signal(unsi
|
pc, address, is_write, *(unsigned long *)old_set); |
pc, address, is_write, *(unsigned long *)old_set); |
#endif |
#endif |
/* XXX: locking issue */ |
/* XXX: locking issue */ |
if (is_write && page_unprotect(address, pc, puc)) { |
if (is_write && page_unprotect(h2g(address), pc, puc)) { |
return 1; |
return 1; |
} |
} |
/* see if it is an MMU fault */ |
/* see if it is an MMU fault */ |
Line 1024 static inline int handle_cpu_signal(unsi
|
Line 1050 static inline int handle_cpu_signal(unsi
|
pc, address, is_write, *(unsigned long *)old_set); |
pc, address, is_write, *(unsigned long *)old_set); |
#endif |
#endif |
/* XXX: locking issue */ |
/* XXX: locking issue */ |
if (is_write && page_unprotect(address, pc, puc)) { |
if (is_write && page_unprotect(h2g(address), pc, puc)) { |
return 1; |
return 1; |
} |
} |
|
|
Line 1074 static inline int handle_cpu_signal(unsi
|
Line 1100 static inline int handle_cpu_signal(unsi
|
pc, address, is_write, *(unsigned long *)old_set); |
pc, address, is_write, *(unsigned long *)old_set); |
#endif |
#endif |
/* XXX: locking issue */ |
/* XXX: locking issue */ |
if (is_write && page_unprotect(address, pc, puc)) { |
if (is_write && page_unprotect(h2g(address), pc, puc)) { |
return 1; |
return 1; |
} |
} |
|
|
Line 1109 static inline int handle_cpu_signal(unsi
|
Line 1135 static inline int handle_cpu_signal(unsi
|
return 1; |
return 1; |
} |
} |
|
|
|
#elif defined (TARGET_SH4) |
|
static inline int handle_cpu_signal(unsigned long pc, unsigned long address, |
|
int is_write, sigset_t *old_set, |
|
void *puc) |
|
{ |
|
TranslationBlock *tb; |
|
int ret; |
|
|
|
if (cpu_single_env) |
|
env = cpu_single_env; /* XXX: find a correct solution for multithread */ |
|
#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(h2g(address), pc, puc)) { |
|
return 1; |
|
} |
|
|
|
/* see if it is an MMU fault */ |
|
ret = cpu_sh4_handle_mmu_fault(env, address, is_write, 1, 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 */ |
|
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, puc); |
|
} |
|
if (ret == 1) { |
|
#if 0 |
|
printf("PF exception: NIP=0x%08x error=0x%x %p\n", |
|
env->nip, env->error_code, tb); |
|
#endif |
|
/* we restore the process signal mask as the sigreturn should |
|
do it (XXX: use sigsetjmp) */ |
|
sigprocmask(SIG_SETMASK, old_set, NULL); |
|
// do_raise_exception_err(env->exception_index, env->error_code); |
|
} else { |
|
/* activate soft MMU for this block */ |
|
cpu_resume_from_signal(env, puc); |
|
} |
|
/* never comes here */ |
|
return 1; |
|
} |
#else |
#else |
#error unsupported target CPU |
#error unsupported target CPU |
#endif |
#endif |
Line 1351 int cpu_signal_handler(int host_signum,
|
Line 1426 int cpu_signal_handler(int host_signum,
|
#ifndef __ISR_VALID |
#ifndef __ISR_VALID |
/* This ought to be in <bits/siginfo.h>... */ |
/* This ought to be in <bits/siginfo.h>... */ |
# define __ISR_VALID 1 |
# define __ISR_VALID 1 |
# define si_flags _sifields._sigfault._si_pad0 |
|
#endif |
#endif |
|
|
int cpu_signal_handler(int host_signum, struct siginfo *info, void *puc) |
int cpu_signal_handler(int host_signum, struct siginfo *info, void *puc) |
Line 1367 int cpu_signal_handler(int host_signum,
|
Line 1441 int cpu_signal_handler(int host_signum,
|
case SIGSEGV: |
case SIGSEGV: |
case SIGBUS: |
case SIGBUS: |
case SIGTRAP: |
case SIGTRAP: |
if (info->si_code && (info->si_flags & __ISR_VALID)) |
if (info->si_code && (info->si_segvflags & __ISR_VALID)) |
/* ISR.W (write-access) is bit 33: */ |
/* ISR.W (write-access) is bit 33: */ |
is_write = (info->si_isr >> 33) & 1; |
is_write = (info->si_isr >> 33) & 1; |
break; |
break; |