PowerPC: Let callers of JitCache_TranslateAddress determine whether the address was translated.

This commit is contained in:
Admiral H. Curtiss 2021-08-09 01:19:22 +02:00
parent 95fbd09691
commit 116d1361d5
2 changed files with 16 additions and 10 deletions

View File

@ -1097,17 +1097,15 @@ bool IsOptimizableGatherPipeWrite(u32 address)
TranslateResult JitCache_TranslateAddress(u32 address)
{
if (!MSR.IR)
return TranslateResult{true, true, address};
return TranslateResult{address};
// TODO: We shouldn't use FLAG_OPCODE if the caller is the debugger.
auto tlb_addr = TranslateAddress<XCheckTLBFlag::Opcode>(address);
const auto tlb_addr = TranslateAddress<XCheckTLBFlag::Opcode>(address);
if (!tlb_addr.Success())
{
return TranslateResult{false, false, 0};
}
return TranslateResult{};
bool from_bat = tlb_addr.result == TranslateAddressResultEnum::BAT_TRANSLATED;
return TranslateResult{true, from_bat, tlb_addr.address};
const bool from_bat = tlb_addr.result == TranslateAddressResultEnum::BAT_TRANSLATED;
return TranslateResult{from_bat, tlb_addr.address};
}
// *********************************************************************************

View File

@ -189,9 +189,17 @@ bool IsOptimizableGatherPipeWrite(u32 address);
struct TranslateResult
{
bool valid;
bool from_bat;
u32 address;
bool valid = false;
bool translated = false;
bool from_bat = false;
u32 address = 0;
TranslateResult() = default;
explicit TranslateResult(u32 address_) : valid(true), address(address_) {}
TranslateResult(bool from_bat_, u32 address_)
: valid(true), translated(true), from_bat(from_bat_), address(address_)
{
}
};
TranslateResult JitCache_TranslateAddress(u32 address);