wince: use exceptions in dyna/decoder.cpp and catch them in driver.cpp

This commit is contained in:
Flyinghead 2019-06-13 18:36:08 +02:00
parent e0949fb9aa
commit 7120512205
4 changed files with 13 additions and 32 deletions

View File

@ -1059,18 +1059,8 @@ bool dec_DecodeBlock(RuntimeBlockInfo* rbi,u32 max_cycles)
}
*/
u32 op;
if (!mmu_enabled())
op = IReadMem16(state.cpu.rpc);
#ifndef NO_MMU
else
{
u32 exception_occurred;
op = mmu_IReadMem16NoEx(state.cpu.rpc, &exception_occurred);
if (exception_occurred)
return false;
}
#endif
u32 op = IReadMem16(state.cpu.rpc);
if (op==0 && state.cpu.is_delayslot)
{
printf("Delayslot 0 hack!\n");

View File

@ -261,8 +261,18 @@ bool RuntimeBlockInfo::Setup(u32 rpc,fpscr_t rfpu_cfg)
oplist.clear();
if (!dec_DecodeBlock(this, SH4_TIMESLICE / 2))
#if !defined(NO_MMU)
try {
#endif
if (!dec_DecodeBlock(this, SH4_TIMESLICE / 2))
return false;
#if !defined(NO_MMU)
}
catch (SH4ThrownException& ex) {
Do_Exception(rpc, ex.expEvn, ex.callVect);
return false;
}
#endif
AnalyseBlock(this);

View File

@ -756,23 +756,6 @@ void DYNACALL mmu_WriteMem(u32 adr, T data)
_vmem_writet<T>(addr, data);
}
u16 DYNACALL mmu_IReadMem16NoEx(u32 vaddr, u32 *exception_occurred)
{
u32 addr;
u32 rv = mmu_instruction_translation(vaddr, addr);
if (rv != MMU_ERROR_NONE)
{
DoMMUException(vaddr, rv, MMU_TT_IREAD);
*exception_occurred = 1;
return 0;
}
else
{
*exception_occurred = 0;
return _vmem_ReadMem16(addr);
}
}
bool mmu_TranslateSQW(u32 adr, u32* out)
{
if (!settings.dreamcast.FullMMU)

View File

@ -95,8 +95,6 @@ void DoMMUException(u32 addr, u32 error_code, u32 access_type);
bool mmu_TranslateSQW(u32 addr, u32* mapped);
u16 DYNACALL mmu_IReadMem16NoEx(u32 adr, u32 *exception_occurred);
template<typename T>
T DYNACALL mmu_ReadMemNoEx(u32 adr, u32 *exception_occurred)
{