Commit ca7c2b1b9f984f622c7495004483016fee61e489

Authored by ths
1 parent 7d600c80

Handle invalid accesses as SIGILL for mips/mipsel userland emulation.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2235 c046a42c-6fe2-441c-8c8c-71466251a162
linux-user/main.c
... ... @@ -1352,6 +1352,8 @@ void cpu_loop(CPUMIPSState *env)
1352 1352 }
1353 1353 }
1354 1354 break;
  1355 + case EXCP_TLBL:
  1356 + case EXCP_TLBS:
1355 1357 case EXCP_CpU:
1356 1358 case EXCP_RI:
1357 1359 info.si_signo = TARGET_SIGILL;
... ...
target-mips/helper.c
... ... @@ -243,6 +243,12 @@ int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
243 243 return ret;
244 244 }
245 245  
  246 +#if defined(CONFIG_USER_ONLY)
  247 +void do_interrupt (CPUState *env)
  248 +{
  249 + env->exception_index = EXCP_NONE;
  250 +}
  251 +#else
246 252 void do_interrupt (CPUState *env)
247 253 {
248 254 target_ulong offset;
... ... @@ -409,3 +415,4 @@ void do_interrupt (CPUState *env)
409 415 }
410 416 env->exception_index = EXCP_NONE;
411 417 }
  418 +#endif /* !defined(CONFIG_USER_ONLY) */
... ...
target-mips/translate.c
... ... @@ -4072,6 +4072,7 @@ void cpu_reset (CPUMIPSState *env)
4072 4072 tlb_flush(env, 1);
4073 4073  
4074 4074 /* Minimal init */
  4075 +#if !defined(CONFIG_USER_ONLY)
4075 4076 if (env->hflags & MIPS_HFLAG_BMASK) {
4076 4077 /* If the exception was raised from a delay slot,
4077 4078 * come back to the jump. */
... ... @@ -4098,9 +4099,11 @@ void cpu_reset (CPUMIPSState *env)
4098 4099 /* Count register increments in debug mode, EJTAG version 1 */
4099 4100 env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER);
4100 4101 env->CP0_PRid = MIPS_CPU;
  4102 +#endif
4101 4103 env->exception_index = EXCP_NONE;
4102 4104 #if defined(CONFIG_USER_ONLY)
4103 4105 env->hflags |= MIPS_HFLAG_UM;
  4106 + env->user_mode_only = 1;
4104 4107 #endif
4105 4108 #ifdef MIPS_USES_FPU
4106 4109 env->fcr0 = MIPS_FCR0;
... ...