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

Replaces page fault triggers with assembly #15053

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

RipleyTom
Copy link
Contributor

Fixes #14949.

Clang optimizes vm::_ref<atomic_t>(test / 4096 == begin / 4096 ? begin : test) += 0; to a simple memory barrier as it considers it's the only possible side effect:

lock orl $0x0,-0x40(%rsp)

I added a function with inline assembly to make sure it's not optimized away with a fallback to a volatile value that shouldn't be optimized away either.

rpcs3/util/asm.hpp Outdated Show resolved Hide resolved
@elad335
Copy link
Contributor

elad335 commented Jan 16, 2024

Maybe instead, do

T value; // Unspecified value
static_cast<atomic_t*>->compare_and_swap(value, value)

@RipleyTom
Copy link
Contributor Author

Wouldn't that just trigger read fault in most cases?

@elad335 elad335 merged commit 7d55a85 into RPCS3:master Jan 16, 2024
6 checks passed
@RipleyTom RipleyTom deleted the fix_page_fault branch January 26, 2024 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Regression] Gran Turismo 6 doesn't load saves on recent Linux builds (#14800)
3 participants