n64: fix (again) TLB logic in case of invalid TLBs

This is a revert of 56458d5b, while keeping b7f96b7109 which is the
real fix that should have been done all along. The former just papered
over the issue and actually introduced a regression (Goldeneye wouldn't
boot).

Co-Authored-By: remutro <[email protected]>
This commit is contained in:
Giovanni Bajoandremutro authored and Luke Usher committed 2022-04-29 22:02:24 +01:00
1 parent a527ed6d1d
commit 0bf24b3161
1 file changed
+2 -2
+2 -2
View File
@@ -2,6 +2,7 @@
auto CPU::TLB::load(u32 address) -> Match {
for(auto& entry : this->entry) {
if(!entry.globals && entry.addressSpaceID != self.scc.tlb.addressSpaceID) continue;
if((address & entry.addressMaskHi) != (u32)entry.addressCompare) continue;
bool lo = address & entry.addressSelect;
if(!entry.valid[lo]) {
@@ -10,7 +11,6 @@ auto CPU::TLB::load(u32 address) -> Match {
self.exception.tlbLoadInvalid();
return {false};
}
if(!entry.globals && entry.addressSpaceID != self.scc.tlb.addressSpaceID) continue;
physicalAddress = entry.physicalAddress[lo] + (address & entry.addressMaskLo);
self.debugger.tlbLoad(address, physicalAddress);
return {true, entry.cacheAlgorithm[lo] != 2, physicalAddress};
@@ -23,6 +23,7 @@ auto CPU::TLB::load(u32 address) -> Match {
auto CPU::TLB::store(u32 address) -> Match {
for(auto& entry : this->entry) {
if(!entry.globals && entry.addressSpaceID != self.scc.tlb.addressSpaceID) continue;
if((address & entry.addressMaskHi) != (u32)entry.addressCompare) continue;
bool lo = address & entry.addressSelect;
if(!entry.valid[lo]) {
@@ -37,7 +38,6 @@ auto CPU::TLB::store(u32 address) -> Match {
self.exception.tlbModification();
return {false};
}
if(!entry.globals && entry.addressSpaceID != self.scc.tlb.addressSpaceID) continue;
physicalAddress = entry.physicalAddress[lo] + (address & entry.addressMaskLo);
self.debugger.tlbStore(address, physicalAddress);
return {true, entry.cacheAlgorithm[lo] != 2, physicalAddress};