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

Implement _sys_lwmutex_unlock SYS_SYNC_RETRY mode #5680

Merged
merged 3 commits into from
Feb 27, 2019

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Feb 22, 2019

Implement syscall 117, used by liblv2 lwmutex when using protocol SYS_SYNC_RETRY
on unlock, this mode unlocks the lwmutex, and awakes a waiter with EBUSY error code.
in this case the waiter in liblv2 lwmutex_lock retries to lock and call the syscall again.
Fixes OG Infinite Battle when using load liblv2 only option, allows it to go ingame. (ingame in auto lib loading)

@uaqlover
Copy link

only come to say you are the reason for most fix's and make most games playable

thanks a lot elad

arg6 doesnt exist, if arg4 is not negative name is discarded and treated as 0.
@elad335
Copy link
Contributor Author

elad335 commented Feb 22, 2019

I did more reverse engineering for this syscall, turns out this syscall uses unique unlocking flags as opposed to sys_lwmutex_unlock.
The unlocking flags are being ORed in both syscall 117 and sys_lwmutex_unlock.
Any of those flags is enough for sys_lwmutex_lock to acquire the lock, and clears the flags.
When only the flag of syscall 117 is used, the return value of sys_lwmutex_lock is EBUSY.
sys_lwmutex_trylock on the other hand, accepts only the flag from sys_lwmutex_unlock, but clears both on success.

Testcase for all of this: https://github.com/elad335/myps3tests/tree/master/ppu_tests/sys_lwmutex_117%20syscall

@Nekotekina Nekotekina merged commit a22297f into RPCS3:master Feb 27, 2019
@elad335 elad335 deleted the lwmutex branch March 1, 2019 08:46
elad335 added a commit to elad335/rpcs3 that referenced this pull request Mar 2, 2019
sys_lwcond_wait unlocks always with the 'usual' unlocking flags
elad335 added a commit to elad335/rpcs3 that referenced this pull request Mar 3, 2019
sys_lwcond_wait unlocks always with the 'usual' unlocking flags
elad335 added a commit to elad335/rpcs3 that referenced this pull request Mar 5, 2019
sys_lwcond_wait unlocks always with the 'usual' unlocking flags
Nekotekina added a commit to Nekotekina/rpcs3 that referenced this pull request Mar 6, 2019
Implement missing SYS_SYNC_RETRY logic
Following RPCS3#5680
elad335 added a commit to elad335/rpcs3 that referenced this pull request Mar 8, 2019
sys_lwcond_wait unlocks always with the 'usual' unlocking flags
Nekotekina pushed a commit that referenced this pull request Mar 8, 2019
sys_lwcond_wait unlocks always with the 'usual' unlocking flags
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.

4 participants