Fix regression: We should triage MIPS internal exceptions to Unicorn exceptions
This commit is contained in:
@@ -408,7 +408,9 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
|
|||||||
// Unicorn: If un-catched interrupt, stop executions.
|
// Unicorn: If un-catched interrupt, stop executions.
|
||||||
if (!catched) {
|
if (!catched) {
|
||||||
// printf("AAAAAAAAAAAA\n"); qq
|
// printf("AAAAAAAAAAAA\n"); qq
|
||||||
|
if (uc->invalid_error == UC_ERR_OK) {
|
||||||
uc->invalid_error = UC_ERR_EXCEPTION;
|
uc->invalid_error = UC_ERR_EXCEPTION;
|
||||||
|
}
|
||||||
cpu->halted = 1;
|
cpu->halted = 1;
|
||||||
*ret = EXCP_HLT;
|
*ret = EXCP_HLT;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -535,6 +535,18 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
|
|||||||
#endif
|
#endif
|
||||||
cs->exception_index = exception;
|
cs->exception_index = exception;
|
||||||
env->error_code = error_code;
|
env->error_code = error_code;
|
||||||
|
|
||||||
|
// Dispatch internal exceptions to Unicorn Exceptions
|
||||||
|
switch (exception) {
|
||||||
|
case EXCP_TLBL:
|
||||||
|
env->uc->invalid_error = UC_ERR_READ_UNMAPPED;
|
||||||
|
env->uc->invalid_addr = address;
|
||||||
|
break;
|
||||||
|
case EXCP_TLBS:
|
||||||
|
env->uc->invalid_error = UC_ERR_WRITE_UNMAPPED;
|
||||||
|
env->uc->invalid_addr = address;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hwaddr mips_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
hwaddr mips_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
||||||
|
|||||||
@@ -1098,6 +1098,15 @@ void mips_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (excp) {
|
||||||
|
case EXCP_AdEL:
|
||||||
|
env->uc->invalid_error = UC_ERR_READ_UNALIGNED;
|
||||||
|
break;
|
||||||
|
case EXCP_AdES:
|
||||||
|
env->uc->invalid_error = UC_ERR_WRITE_UNALIGNED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
do_raise_exception_err(env, excp, error_code, retaddr);
|
do_raise_exception_err(env, excp, error_code, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user