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: Refactor ReadFromHardware #10642

Merged
merged 3 commits into from May 7, 2022

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented May 7, 2022

When I was creating PR #9964, I ended up refactoring WriteToHardware a bunch. This PR applies most of those refactorizations to ReadFromHardware.

See commit descriptions for details.

This fixes a problem where Dolphin could crash if a non-translated
read crossed the end of a physical memory region.

The same change was applied to WriteToHardware in ecbce0a.
This refactorization is done just to match the order that I made
WriteToHardware use in 543ed8a. For WriteToHardware, it's important that
things like MMIO and gather pipe are handled before we reach a special
piece of code that only should get triggered for writes that hit memory
directly, but for ReadFromHardware we don't have any code like that.
const u32 em_address_start_page = em_address & ~(HW_PAGE_SIZE - 1);
const u32 em_address_end_page = (em_address + sizeof(T) - 1) & ~(HW_PAGE_SIZE - 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth creating a constant like PAGE_ALIGNMENT_MASK and using it here and in WriteToHardware?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@lioncash lioncash merged commit 997754b into dolphin-emu:master May 7, 2022
10 checks passed
@JosJuice JosJuice deleted the refactor-mmu-read branch May 7, 2022 21:22
@bluejaueegui6817
Copy link

bluejaueegui6817 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants