kernel32: Move interlocked functions to kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-09-08 13:17:48 +02:00
parent 765815729f
commit c683e7e5a1
4 changed files with 101 additions and 40 deletions

View File

@ -940,9 +940,9 @@
@ stdcall IdnToNameprepUnicode(long wstr long ptr long)
@ stdcall IdnToUnicode(long wstr long ptr long)
@ stdcall InitAtomTable(long)
@ stdcall InitOnceBeginInitialize(ptr long ptr ptr)
@ stdcall InitOnceComplete(ptr long ptr)
@ stdcall InitOnceExecuteOnce(ptr ptr ptr ptr)
@ stdcall InitOnceBeginInitialize(ptr long ptr ptr) kernelbase.InitOnceBeginInitialize
@ stdcall InitOnceComplete(ptr long ptr) kernelbase.InitOnceComplete
@ stdcall InitOnceExecuteOnce(ptr ptr ptr ptr) kernelbase.InitOnceExecuteOnce
@ stdcall InitOnceInitialize(ptr) ntdll.RtlRunOnceInitialize
@ stdcall InitializeConditionVariable(ptr) ntdll.RtlInitializeConditionVariable
# @ stub InitializeContext

View File

@ -1071,35 +1071,6 @@ BOOL WINAPI QueryMemoryResourceNotification(HANDLE handle, PBOOL state)
return FALSE;
}
/***********************************************************************
* InitOnceBeginInitialize (KERNEL32.@)
*/
BOOL WINAPI InitOnceBeginInitialize( INIT_ONCE *once, DWORD flags, BOOL *pending, void **context )
{
NTSTATUS status = RtlRunOnceBeginInitialize( once, flags, context );
if (status >= 0) *pending = (status == STATUS_PENDING);
else SetLastError( RtlNtStatusToDosError(status) );
return status >= 0;
}
/***********************************************************************
* InitOnceComplete (KERNEL32.@)
*/
BOOL WINAPI InitOnceComplete( INIT_ONCE *once, DWORD flags, void *context )
{
NTSTATUS status = RtlRunOnceComplete( once, flags, context );
if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) );
return !status;
}
/***********************************************************************
* InitOnceExecuteOnce (KERNEL32.@)
*/
BOOL WINAPI InitOnceExecuteOnce( INIT_ONCE *once, PINIT_ONCE_FN func, void *param, void **context )
{
return !RtlRunOnceExecuteOnce( once, (PRTL_RUN_ONCE_INIT_FN)func, param, context );
}
#ifdef __i386__
/***********************************************************************

View File

@ -794,9 +794,9 @@
@ stdcall ImpersonateNamedPipeClient(long)
@ stdcall ImpersonateSelf(long)
# @ stub IncrementPackageStatusVersion
@ stdcall InitOnceBeginInitialize(ptr long ptr ptr) kernel32.InitOnceBeginInitialize
@ stdcall InitOnceComplete(ptr long ptr) kernel32.InitOnceComplete
@ stdcall InitOnceExecuteOnce(ptr ptr ptr ptr) kernel32.InitOnceExecuteOnce
@ stdcall InitOnceBeginInitialize(ptr long ptr ptr)
@ stdcall InitOnceComplete(ptr long ptr)
@ stdcall InitOnceExecuteOnce(ptr ptr ptr ptr)
@ stdcall InitOnceInitialize(ptr) ntdll.RtlRunOnceInitialize
@ stdcall InitializeAcl(ptr long long)
@ stdcall InitializeConditionVariable(ptr) ntdll.RtlInitializeConditionVariable
@ -813,13 +813,13 @@
@ stdcall InitializeSid(ptr ptr long)
# @ stub InitializeSynchronizationBarrier
# @ stub InstallELAMCertificateInfo
@ stdcall -arch=i386 InterlockedCompareExchange(ptr long long) kernel32.InterlockedCompareExchange
@ stdcall -arch=i386 InterlockedCompareExchange(ptr long long)
@ stdcall -arch=i386 -ret64 InterlockedCompareExchange64(ptr int64 int64) ntdll.RtlInterlockedCompareExchange64
@ stdcall -arch=i386 InterlockedDecrement(ptr) kernel32.InterlockedDecrement
@ stdcall -arch=i386 InterlockedExchange(ptr long) kernel32.InterlockedExchange
@ stdcall -arch=i386 InterlockedExchangeAdd(ptr long ) kernel32.InterlockedExchangeAdd
@ stdcall -arch=i386 InterlockedDecrement(ptr)
@ stdcall -arch=i386 InterlockedExchange(ptr long)
@ stdcall -arch=i386 InterlockedExchangeAdd(ptr long )
@ stdcall InterlockedFlushSList(ptr) ntdll.RtlInterlockedFlushSList
@ stdcall -arch=i386 InterlockedIncrement(ptr) kernel32.InterlockedIncrement
@ stdcall -arch=i386 InterlockedIncrement(ptr)
@ stdcall InterlockedPopEntrySList(ptr) ntdll.RtlInterlockedPopEntrySList
@ stdcall InterlockedPushEntrySList(ptr ptr) ntdll.RtlInterlockedPushEntrySList
@ stdcall -fastcall InterlockedPushListSList(ptr ptr ptr long) ntdll.RtlInterlockedPushListSList

View File

@ -1383,3 +1383,93 @@ BOOL WINAPI DECLSPEC_HOTPATCH WaitNamedPipeW( LPCWSTR name, DWORD timeout )
NtClose( pipe_dev );
return set_ntstatus( status );
}
/***********************************************************************
* Interlocked functions
***********************************************************************/
/***********************************************************************
* InitOnceBeginInitialize (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH InitOnceBeginInitialize( INIT_ONCE *once, DWORD flags,
BOOL *pending, void **context )
{
NTSTATUS status = RtlRunOnceBeginInitialize( once, flags, context );
if (status >= 0) *pending = (status == STATUS_PENDING);
else SetLastError( RtlNtStatusToDosError(status) );
return status >= 0;
}
/***********************************************************************
* InitOnceComplete (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH InitOnceComplete( INIT_ONCE *once, DWORD flags, void *context )
{
return set_ntstatus( RtlRunOnceComplete( once, flags, context ));
}
/***********************************************************************
* InitOnceExecuteOnce (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH InitOnceExecuteOnce( INIT_ONCE *once, PINIT_ONCE_FN func,
void *param, void **context )
{
return !RtlRunOnceExecuteOnce( once, (PRTL_RUN_ONCE_INIT_FN)func, param, context );
}
#ifdef __i386__
/***********************************************************************
* InterlockedCompareExchange (kernelbase.@)
*/
__ASM_STDCALL_FUNC(InterlockedCompareExchange, 12,
"movl 12(%esp),%eax\n\t"
"movl 8(%esp),%ecx\n\t"
"movl 4(%esp),%edx\n\t"
"lock; cmpxchgl %ecx,(%edx)\n\t"
"ret $12")
/***********************************************************************
* InterlockedExchange (kernelbase.@)
*/
__ASM_STDCALL_FUNC(InterlockedExchange, 8,
"movl 8(%esp),%eax\n\t"
"movl 4(%esp),%edx\n\t"
"lock; xchgl %eax,(%edx)\n\t"
"ret $8")
/***********************************************************************
* InterlockedExchangeAdd (kernelbase.@)
*/
__ASM_STDCALL_FUNC(InterlockedExchangeAdd, 8,
"movl 8(%esp),%eax\n\t"
"movl 4(%esp),%edx\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"ret $8")
/***********************************************************************
* InterlockedIncrement (kernelbase.@)
*/
__ASM_STDCALL_FUNC(InterlockedIncrement, 4,
"movl 4(%esp),%edx\n\t"
"movl $1,%eax\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"incl %eax\n\t"
"ret $4")
/***********************************************************************
* InterlockedDecrement (kernelbase.@)
*/
__ASM_STDCALL_FUNC(InterlockedDecrement, 4,
"movl 4(%esp),%edx\n\t"
"movl $-1,%eax\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"decl %eax\n\t"
"ret $4")
#endif /* __i386__ */