Skip to content

Commit ba9bbb3

Browse files
joevtdingusdev
authored andcommitted
Catch all errors for debug read/write methods.
1 parent 60c9523 commit ba9bbb3

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

cpu/ppc/ppcmmu.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,8 @@ uint64_t mem_read_dbg(uint32_t virt_addr, uint32_t size) {
14471447
default:
14481448
ret_val = mmu_read_vmem<uint8_t>(NO_OPCODE, virt_addr);
14491449
}
1450-
} catch (std::invalid_argument& exc) {
1450+
}
1451+
catch (std::invalid_argument& exc) {
14511452
/* restore MMU-related CPU state */
14521453
mmu_exception_handler = ppc_exception_handler;
14531454
ppc_state.spr[SPR::DSISR] = save_dsisr;
@@ -1456,6 +1457,15 @@ uint64_t mem_read_dbg(uint32_t virt_addr, uint32_t size) {
14561457
/* rethrow MMU exception */
14571458
throw exc;
14581459
}
1460+
catch (...) {
1461+
/* restore MMU-related CPU state */
1462+
mmu_exception_handler = ppc_exception_handler;
1463+
ppc_state.spr[SPR::DSISR] = save_dsisr;
1464+
ppc_state.spr[SPR::DAR] = save_dar;
1465+
1466+
/* rethrow MMU exception */
1467+
throw(false);
1468+
}
14591469

14601470
/* restore MMU-related CPU state */
14611471
mmu_exception_handler = ppc_exception_handler;
@@ -1549,7 +1559,12 @@ bool mmu_translate_dbg(uint32_t guest_va, uint32_t &guest_pa) {
15491559
guest_pa = tlb1_entry->phys_tag | (guest_va & 0xFFFUL);
15501560
is_mapped = true;
15511561
} while (0);
1552-
} catch (std::invalid_argument& exc) {
1562+
}
1563+
catch (std::invalid_argument& exc) {
1564+
LOG_F(WARNING, "Unmapped address 0x%08X", guest_va);
1565+
is_mapped = false;
1566+
}
1567+
catch (...) {
15531568
LOG_F(WARNING, "Unmapped address 0x%08X", guest_va);
15541569
is_mapped = false;
15551570
}

0 commit comments

Comments
 (0)