target/mips: Don't update BadVAddr register in Debug Mode

BadVAddr should not be updated if (env->hflags & MIPS_HFLAG_DM) is
set.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
This commit is contained in:
Yongbok Kim 2018-08-02 16:15:55 +02:00 committed by Aleksandar Markovic
parent fa192d4974
commit e807bcc151
2 changed files with 12 additions and 4 deletions

View File

@ -502,7 +502,9 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
break; break;
} }
/* Raise exception */ /* Raise exception */
env->CP0_BadVAddr = address; if (!(env->hflags & MIPS_HFLAG_DM)) {
env->CP0_BadVAddr = address;
}
env->CP0_Context = (env->CP0_Context & ~0x007fffff) | env->CP0_Context = (env->CP0_Context & ~0x007fffff) |
((address >> 9) & 0x007ffff0); ((address >> 9) & 0x007ffff0);
env->CP0_EntryHi = (env->CP0_EntryHi & env->CP0_EntryHi_ASID_mask) | env->CP0_EntryHi = (env->CP0_EntryHi & env->CP0_EntryHi_ASID_mask) |

View File

@ -271,7 +271,9 @@ static inline hwaddr do_translate_address(CPUMIPSState *env,
target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, int mem_idx) \ target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, int mem_idx) \
{ \ { \
if (arg & almask) { \ if (arg & almask) { \
env->CP0_BadVAddr = arg; \ if (!(env->hflags & MIPS_HFLAG_DM)) { \
env->CP0_BadVAddr = arg; \
} \
do_raise_exception(env, EXCP_AdEL, GETPC()); \ do_raise_exception(env, EXCP_AdEL, GETPC()); \
} \ } \
env->lladdr = do_translate_address(env, arg, 0, GETPC()); \ env->lladdr = do_translate_address(env, arg, 0, GETPC()); \
@ -291,7 +293,9 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong arg1, \
target_long tmp; \ target_long tmp; \
\ \
if (arg2 & almask) { \ if (arg2 & almask) { \
env->CP0_BadVAddr = arg2; \ if (!(env->hflags & MIPS_HFLAG_DM)) { \
env->CP0_BadVAddr = arg2; \
} \
do_raise_exception(env, EXCP_AdES, GETPC()); \ do_raise_exception(env, EXCP_AdES, GETPC()); \
} \ } \
if (do_translate_address(env, arg2, 1, GETPC()) == env->lladdr) { \ if (do_translate_address(env, arg2, 1, GETPC()) == env->lladdr) { \
@ -2437,7 +2441,9 @@ void mips_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
int error_code = 0; int error_code = 0;
int excp; int excp;
env->CP0_BadVAddr = addr; if (!(env->hflags & MIPS_HFLAG_DM)) {
env->CP0_BadVAddr = addr;
}
if (access_type == MMU_DATA_STORE) { if (access_type == MMU_DATA_STORE) {
excp = EXCP_AdES; excp = EXCP_AdES;