Commit 4cbf74b6b8097ca4c2396449babff639dab601cf
1 parent
33417e70
soft mmu support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@355 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
23 additions
and
6 deletions
cpu-exec.c
| @@ -245,6 +245,7 @@ int cpu_exec(CPUState *env1) | @@ -245,6 +245,7 @@ int cpu_exec(CPUState *env1) | ||
| 245 | (unsigned long)env->segs[R_SS].base) != 0) << | 245 | (unsigned long)env->segs[R_SS].base) != 0) << |
| 246 | GEN_FLAG_ADDSEG_SHIFT; | 246 | GEN_FLAG_ADDSEG_SHIFT; |
| 247 | flags |= env->cpl << GEN_FLAG_CPL_SHIFT; | 247 | flags |= env->cpl << GEN_FLAG_CPL_SHIFT; |
| 248 | + flags |= env->soft_mmu << GEN_FLAG_SOFT_MMU_SHIFT; | ||
| 248 | flags |= (env->eflags & VM_MASK) >> (17 - GEN_FLAG_VM_SHIFT); | 249 | flags |= (env->eflags & VM_MASK) >> (17 - GEN_FLAG_VM_SHIFT); |
| 249 | flags |= (env->eflags & (IOPL_MASK | TF_MASK)); | 250 | flags |= (env->eflags & (IOPL_MASK | TF_MASK)); |
| 250 | cs_base = env->segs[R_CS].base; | 251 | cs_base = env->segs[R_CS].base; |
| @@ -333,6 +334,15 @@ int cpu_exec(CPUState *env1) | @@ -333,6 +334,15 @@ int cpu_exec(CPUState *env1) | ||
| 333 | gen_func(); | 334 | gen_func(); |
| 334 | #endif | 335 | #endif |
| 335 | env->current_tb = NULL; | 336 | env->current_tb = NULL; |
| 337 | + /* reset soft MMU for next block (it can currently | ||
| 338 | + only be set by a memory fault) */ | ||
| 339 | +#if defined(TARGET_I386) && !defined(CONFIG_SOFTMMU) | ||
| 340 | + if (env->soft_mmu) { | ||
| 341 | + env->soft_mmu = 0; | ||
| 342 | + /* do not allow linking to another block */ | ||
| 343 | + T0 = 0; | ||
| 344 | + } | ||
| 345 | +#endif | ||
| 336 | } | 346 | } |
| 337 | } else { | 347 | } else { |
| 338 | } | 348 | } |
| @@ -478,14 +488,21 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | @@ -478,14 +488,21 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | ||
| 478 | a virtual CPU fault */ | 488 | a virtual CPU fault */ |
| 479 | cpu_restore_state(tb, env, pc); | 489 | cpu_restore_state(tb, env, pc); |
| 480 | } | 490 | } |
| 491 | + if (ret == 1) { | ||
| 481 | #if 0 | 492 | #if 0 |
| 482 | - printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", | ||
| 483 | - env->eip, env->cr[2], env->error_code); | 493 | + printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", |
| 494 | + env->eip, env->cr[2], env->error_code); | ||
| 484 | #endif | 495 | #endif |
| 485 | - /* we restore the process signal mask as the sigreturn should | ||
| 486 | - do it (XXX: use sigsetjmp) */ | ||
| 487 | - sigprocmask(SIG_SETMASK, old_set, NULL); | ||
| 488 | - raise_exception_err(EXCP0E_PAGE, env->error_code); | 496 | + /* we restore the process signal mask as the sigreturn should |
| 497 | + do it (XXX: use sigsetjmp) */ | ||
| 498 | + sigprocmask(SIG_SETMASK, old_set, NULL); | ||
| 499 | + raise_exception_err(EXCP0E_PAGE, env->error_code); | ||
| 500 | + } else { | ||
| 501 | + /* activate soft MMU for this block */ | ||
| 502 | + env->soft_mmu = 1; | ||
| 503 | + sigprocmask(SIG_SETMASK, old_set, NULL); | ||
| 504 | + cpu_loop_exit(); | ||
| 505 | + } | ||
| 489 | /* never comes here */ | 506 | /* never comes here */ |
| 490 | return 1; | 507 | return 1; |
| 491 | } | 508 | } |