Add and use svcArbitrateAddressNoTimeout (minor ABI optimization)

This commit is contained in:
fincs 2020-06-30 18:45:03 +02:00
parent 9974ed1aa3
commit 19fd446ac5
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
4 changed files with 25 additions and 3 deletions

View File

@ -915,9 +915,22 @@ Result svcCreateAddressArbiter(Handle *arbiter);
* @param addr A pointer to a s32 value.
* @param type Type of action to be performed by the arbiter
* @param value Number of threads to signal if using @ref ARBITRATION_SIGNAL, or the value used for comparison.
* @warning Please use \ref syncArbitrateAddress or \ref syncArbitrateAddressWithTimeout instead.
* @param timeout_ns Optional timeout in nanoseconds when using TIMEOUT actions, ignored otherwise. If not needed, use \ref svcArbitrateAddressNoTimeout instead.
* @note Usage of this syscall entails an implicit Data Memory Barrier (dmb).
* @warning Please use \ref syncArbitrateAddressWithTimeout instead.
*/
Result svcArbitrateAddress(Handle arbiter, u32 addr, ArbitrationType type, s32 value, s64 nanoseconds);
Result svcArbitrateAddress(Handle arbiter, u32 addr, ArbitrationType type, s32 value, s64 timeout_ns);
/**
* @brief Same as \ref svcArbitrateAddress but with the timeout_ns parameter undefined.
* @param arbiter Handle of the arbiter
* @param addr A pointer to a s32 value.
* @param type Type of action to be performed by the arbiter
* @param value Number of threads to signal if using @ref ARBITRATION_SIGNAL, or the value used for comparison.
* @note Usage of this syscall entails an implicit Data Memory Barrier (dmb).
* @warning Please use \ref syncArbitrateAddress instead.
*/
Result svcArbitrateAddressNoTimeout(Handle arbiter, u32 addr, ArbitrationType type, s32 value);
/**
* @brief Sends a synchronized request to a session handle.

View File

@ -144,6 +144,8 @@ static inline bool __strexb(u8* addr, u8 val)
* // Does *nothing* since val >= 0
* syncArbitrateAddress(&val,ARBITRATION_WAIT_IF_LESS_THAN,0);
* @endcode
*
* @note Usage of this function entails an implicit Data Memory Barrier (dmb).
*/
Result syncArbitrateAddress(s32* addr, ArbitrationType type, s32 value);
@ -160,6 +162,8 @@ Result syncArbitrateAddress(s32* addr, ArbitrationType type, s32 value);
* // Thread will wait for a signal or wake up after 10000000 nanoseconds because val < 1.
* syncArbitrateAddressWithTimeout(&val,ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT,1,10000000LL);
* @endcode
*
* @note Usage of this function entails an implicit Data Memory Barrier (dmb).
*/
Result syncArbitrateAddressWithTimeout(s32* addr, ArbitrationType type, s32 value, s64 timeout_ns);

View File

@ -249,6 +249,11 @@ SVC_BEGIN svcArbitrateAddress
bx lr
SVC_END
SVC_BEGIN svcArbitrateAddressNoTimeout
svc 0x22
bx lr
SVC_END
SVC_BEGIN svcCloseHandle
svc 0x23
bx lr

View File

@ -18,7 +18,7 @@ void __sync_fini(void)
Result syncArbitrateAddress(s32* addr, ArbitrationType type, s32 value)
{
return svcArbitrateAddress(arbiter, (u32)addr, type, value, 0);
return svcArbitrateAddressNoTimeout(arbiter, (u32)addr, type, value);
}
Result syncArbitrateAddressWithTimeout(s32* addr, ArbitrationType type, s32 value, s64 timeout_ns)