Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerPC: Add access size parameter to MMU::IsOptimizableRAMAddress #12489

Merged
merged 1 commit into from Jan 12, 2024

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Jan 8, 2024

For correctness, we need to check not only the start address of the memory access but also the end address.

@iwubcode
Copy link
Contributor

Sorry for the potential dumb question but does this have any implications on specific software or is it just a safety thing?

@@ -930,8 +930,10 @@ bool MMU::IsOptimizableRAMAddress(const u32 address) const
//
// We store whether an access can be optimized to an unchecked access
// in dbat_table.
u32 bat_result = m_dbat_table[address >> BAT_INDEX_SHIFT];
return (bat_result & BAT_PHYSICAL_BIT) != 0;
const u32 last_byte_address = address + (access_size >> 3) - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a TODO a few lines up that you can remove now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also is this even correct? Why the bitshift by 3?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh is the size given in bits, not bytes? In that case yeah that makes sense then.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a TODO a few lines up that you can remove now.

Oops, yes.

Oh is the size given in bits, not bytes? In that case yeah that makes sense then.

Yeah, it's in bits, following the pattern used by IsOptimizableMMIOAccess.

@JosJuice
Copy link
Member Author

Sorry for the potential dumb question but does this have any implications on specific software or is it just a safety thing?

Just for safety. No software is known to be affected.

For correctness, we need to check not only the start address of the
memory access but also the end address.
@AdmiralCurtiss AdmiralCurtiss merged commit bca5b10 into dolphin-emu:master Jan 12, 2024
11 checks passed
@JosJuice JosJuice deleted the optimizable-access-size branch January 12, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants