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

mutex: fix svcArbitrateLock call arguments #620

Closed

Conversation

xerpi
Copy link

@xerpi xerpi commented Sep 9, 2023

1st (thread handle) and 3rd (tag) arguments were swapped.

1st (thread handle) and 3rd (tag) arguments were swapped.
@fincs
Copy link
Contributor

fincs commented Sep 9, 2023

https://github.com/Atmosphere-NX/Atmosphere/blob/master/libraries/libmesosphere/source/svc/kern_svc_lock.cpp#L28

The first argument is the handle of the thread that is currently holding the lock, not our own thread handle. The third argument is our own tag. This tag is the value that is supposed to be our own thread handle, which is retrieved a bit earlier: https://github.com/switchbrew/libnx/blob/master/nx/source/kernel/mutex.c#L34C5-L34C38

@fincs fincs closed this Sep 9, 2023
@xerpi
Copy link
Author

xerpi commented Sep 9, 2023

https://github.com/Atmosphere-NX/Atmosphere/blob/master/libraries/libmesosphere/source/svc/kern_svc_lock.cpp#L28

The first argument is the handle of the thread that is currently holding the lock, not our own thread handle. The third argument is our own tag. This tag is the value that is supposed to be our own thread handle, which is retrieved a bit earlier: https://github.com/switchbrew/libnx/blob/master/nx/source/kernel/mutex.c#L34C5-L34C38

That makes more sense, thanks for the explanation!

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

Successfully merging this pull request may close these issues.

2 participants