Commit 10584d20 authored by Alexandre Julliard's avatar Alexandre Julliard

include: Use the __fastcall attribute directly for the Windows build.

parent e755ea23
......@@ -37,39 +37,46 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl);
#ifdef __i386__
extern void * WINAPI call_fastcall_func1( void *func, const void *a );
__ASM_STDCALL_FUNC( call_fastcall_func1, 8,
#ifndef _WIN32
extern void * WINAPI wrap_fastcall_func1( void *func, const void *a );
__ASM_STDCALL_FUNC( wrap_fastcall_func1, 8,
"popl %ecx\n\t"
"popl %eax\n\t"
"xchgl (%esp),%ecx\n\t"
"jmp *%eax" );
extern void * WINAPI call_fastcall_func2( void *func, const void *a, const void *b );
__ASM_STDCALL_FUNC( call_fastcall_func2, 12,
extern void * WINAPI wrap_fastcall_func2( void *func, const void *a, const void *b );
__ASM_STDCALL_FUNC( wrap_fastcall_func2, 12,
"popl %edx\n\t"
"popl %eax\n\t"
"popl %ecx\n\t"
"xchgl (%esp),%edx\n\t"
"jmp *%eax" );
extern void WINAPI ExAcquireFastMutexUnsafe( FAST_MUTEX * );
#define call_fastcall_func1(func,a) wrap_fastcall_func1(func,a)
#define call_fastcall_func2(func,a,b) wrap_fastcall_func2(func,a,b)
#else /* _WIN32 */
#define call_fastcall_func1(func,a) func(a)
#define call_fastcall_func2(func,a,b) func(a,b)
#endif /* _WIN32 */
DEFINE_FASTCALL1_WRAPPER( ExAcquireFastMutex )
void WINAPI ExAcquireFastMutex( FAST_MUTEX *mutex )
void FASTCALL ExAcquireFastMutex( FAST_MUTEX *mutex )
{
call_fastcall_func1( ExAcquireFastMutexUnsafe, mutex );
}
extern void WINAPI ExReleaseFastMutexUnsafe( FAST_MUTEX * );
DEFINE_FASTCALL1_WRAPPER( ExReleaseFastMutex )
void WINAPI ExReleaseFastMutex( FAST_MUTEX *mutex )
void FASTCALL ExReleaseFastMutex( FAST_MUTEX *mutex )
{
call_fastcall_func1( ExReleaseFastMutexUnsafe, mutex );
}
DEFINE_FASTCALL1_WRAPPER( ExTryToAcquireFastMutex )
BOOLEAN WINAPI ExTryToAcquireFastMutex( FAST_MUTEX *mutex )
BOOLEAN FASTCALL ExTryToAcquireFastMutex( FAST_MUTEX *mutex )
{
TRACE("mutex %p.\n", mutex);
......@@ -77,7 +84,7 @@ BOOLEAN WINAPI ExTryToAcquireFastMutex( FAST_MUTEX *mutex )
}
DEFINE_FASTCALL1_WRAPPER( KfAcquireSpinLock )
KIRQL WINAPI KfAcquireSpinLock( KSPIN_LOCK *lock )
KIRQL FASTCALL KfAcquireSpinLock( KSPIN_LOCK *lock )
{
KIRQL irql;
KeAcquireSpinLock( lock, &irql );
......@@ -92,7 +99,7 @@ void WINAPI KeAcquireSpinLock( KSPIN_LOCK *lock, KIRQL *irql )
}
DEFINE_FASTCALL_WRAPPER( KfReleaseSpinLock, 8 )
void WINAPI KfReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql )
void FASTCALL KfReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql )
{
KeReleaseSpinLock( lock, irql );
}
......@@ -103,18 +110,14 @@ void WINAPI KeReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql )
KeReleaseSpinLockFromDpcLevel( lock );
}
extern void WINAPI KeAcquireInStackQueuedSpinLockAtDpcLevel( KSPIN_LOCK *, KLOCK_QUEUE_HANDLE * );
DEFINE_FASTCALL_WRAPPER( KeAcquireInStackQueuedSpinLock, 8 )
void WINAPI KeAcquireInStackQueuedSpinLock( KSPIN_LOCK *lock, KLOCK_QUEUE_HANDLE *queue )
void FASTCALL KeAcquireInStackQueuedSpinLock( KSPIN_LOCK *lock, KLOCK_QUEUE_HANDLE *queue )
{
call_fastcall_func2( KeAcquireInStackQueuedSpinLockAtDpcLevel, lock, queue );
}
extern void WINAPI KeReleaseInStackQueuedSpinLockFromDpcLevel( KLOCK_QUEUE_HANDLE * );
DEFINE_FASTCALL1_WRAPPER( KeReleaseInStackQueuedSpinLock )
void WINAPI KeReleaseInStackQueuedSpinLock( KLOCK_QUEUE_HANDLE *queue )
void FASTCALL KeReleaseInStackQueuedSpinLock( KLOCK_QUEUE_HANDLE *queue )
{
call_fastcall_func1( KeReleaseInStackQueuedSpinLockFromDpcLevel, queue );
}
......@@ -123,13 +126,13 @@ void WINAPI KeReleaseInStackQueuedSpinLock( KLOCK_QUEUE_HANDLE *queue )
#if defined(__i386__) || defined(__arm__) || defined(__aarch64__)
DEFINE_FASTCALL1_WRAPPER( KfLowerIrql )
VOID WINAPI KfLowerIrql(KIRQL NewIrql)
VOID FASTCALL KfLowerIrql(KIRQL NewIrql)
{
FIXME( "(%u) stub!\n", NewIrql );
}
DEFINE_FASTCALL1_WRAPPER( KfRaiseIrql )
KIRQL WINAPI KfRaiseIrql(KIRQL NewIrql)
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
{
FIXME( "(%u) stub!\n", NewIrql );
......
......@@ -1247,8 +1247,8 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushListSListEx(PSLIST_HEADER list, PSLIST_ENT
* RtlInterlockedPushListSList [NTDLL.@]
*/
DEFINE_FASTCALL_WRAPPER(RtlInterlockedPushListSList, 16)
PSLIST_ENTRY WINAPI RtlInterlockedPushListSList(PSLIST_HEADER list, PSLIST_ENTRY first,
PSLIST_ENTRY last, ULONG count)
PSLIST_ENTRY FASTCALL RtlInterlockedPushListSList(PSLIST_HEADER list, PSLIST_ENTRY first,
PSLIST_ENTRY last, ULONG count)
{
return RtlInterlockedPushListSListEx(list, first, last, count);
}
......
......@@ -1946,7 +1946,7 @@ NTSTATUS WINAPI IoCallDriver( DEVICE_OBJECT *device, IRP *irp )
* IofCallDriver (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( IofCallDriver, 8 )
NTSTATUS WINAPI IofCallDriver( DEVICE_OBJECT *device, IRP *irp )
NTSTATUS FASTCALL IofCallDriver( DEVICE_OBJECT *device, IRP *irp )
{
TRACE( "%p %p\n", device, irp );
return IoCallDriver( device, irp );
......@@ -2278,7 +2278,7 @@ VOID WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
* IofCompleteRequest (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( IofCompleteRequest, 8 )
void WINAPI IofCompleteRequest( IRP *irp, UCHAR priority_boost )
void FASTCALL IofCompleteRequest( IRP *irp, UCHAR priority_boost )
{
TRACE( "%p %u\n", irp, priority_boost );
IoCompleteRequest( irp, priority_boost );
......@@ -2314,7 +2314,7 @@ BOOLEAN WINAPI IoCancelIrp( IRP *irp )
* InterlockedCompareExchange (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( NTOSKRNL_InterlockedCompareExchange, 12 )
LONG WINAPI NTOSKRNL_InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
LONG FASTCALL NTOSKRNL_InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
{
return InterlockedCompareExchange( dest, xchg, compare );
}
......@@ -2324,7 +2324,7 @@ LONG WINAPI NTOSKRNL_InterlockedCompareExchange( LONG volatile *dest, LONG xchg,
* InterlockedDecrement (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER( NTOSKRNL_InterlockedDecrement )
LONG WINAPI NTOSKRNL_InterlockedDecrement( LONG volatile *dest )
LONG FASTCALL NTOSKRNL_InterlockedDecrement( LONG volatile *dest )
{
return InterlockedDecrement( dest );
}
......@@ -2334,7 +2334,7 @@ LONG WINAPI NTOSKRNL_InterlockedDecrement( LONG volatile *dest )
* InterlockedExchange (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( NTOSKRNL_InterlockedExchange, 8 )
LONG WINAPI NTOSKRNL_InterlockedExchange( LONG volatile *dest, LONG val )
LONG FASTCALL NTOSKRNL_InterlockedExchange( LONG volatile *dest, LONG val )
{
return InterlockedExchange( dest, val );
}
......@@ -2344,7 +2344,7 @@ LONG WINAPI NTOSKRNL_InterlockedExchange( LONG volatile *dest, LONG val )
* InterlockedExchangeAdd (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( NTOSKRNL_InterlockedExchangeAdd, 8 )
LONG WINAPI NTOSKRNL_InterlockedExchangeAdd( LONG volatile *dest, LONG incr )
LONG FASTCALL NTOSKRNL_InterlockedExchangeAdd( LONG volatile *dest, LONG incr )
{
return InterlockedExchangeAdd( dest, incr );
}
......@@ -2354,7 +2354,7 @@ LONG WINAPI NTOSKRNL_InterlockedExchangeAdd( LONG volatile *dest, LONG incr )
* InterlockedIncrement (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER( NTOSKRNL_InterlockedIncrement )
LONG WINAPI NTOSKRNL_InterlockedIncrement( LONG volatile *dest )
LONG FASTCALL NTOSKRNL_InterlockedIncrement( LONG volatile *dest )
{
return InterlockedIncrement( dest );
}
......@@ -3061,7 +3061,7 @@ NTSTATUS WINAPI ObReferenceObjectByPointer(void *obj, ACCESS_MASK access,
* ObfReferenceObject (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER( ObfReferenceObject )
void WINAPI ObfReferenceObject( void *obj )
void FASTCALL ObfReferenceObject( void *obj )
{
ObReferenceObject( obj );
}
......@@ -3071,7 +3071,7 @@ void WINAPI ObfReferenceObject( void *obj )
* ObfDereferenceObject (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER( ObfDereferenceObject )
void WINAPI ObfDereferenceObject( void *obj )
void FASTCALL ObfDereferenceObject( void *obj )
{
ObDereferenceObject( obj );
}
......@@ -4395,7 +4395,7 @@ typedef struct _EX_PUSH_LOCK_WAIT_BLOCK *PEX_PUSH_LOCK_WAIT_BLOCK;
* ExfUnblockPushLock (NTOSKRNL.@)
*/
DEFINE_FASTCALL_WRAPPER( ExfUnblockPushLock, 8 )
void WINAPI ExfUnblockPushLock( EX_PUSH_LOCK *lock, PEX_PUSH_LOCK_WAIT_BLOCK block )
void FASTCALL ExfUnblockPushLock( EX_PUSH_LOCK *lock, PEX_PUSH_LOCK_WAIT_BLOCK block )
{
FIXME( "stub: %p, %p\n", lock, block );
}
......
......@@ -515,7 +515,7 @@ void WINAPI KeReleaseSpinLockFromDpcLevel( KSPIN_LOCK *lock )
* KeAcquireInStackQueuedSpinLockAtDpcLevel (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( KeAcquireInStackQueuedSpinLockAtDpcLevel, 8 )
void WINAPI KeAcquireInStackQueuedSpinLockAtDpcLevel( KSPIN_LOCK *lock, KLOCK_QUEUE_HANDLE *queue )
void FASTCALL KeAcquireInStackQueuedSpinLockAtDpcLevel( KSPIN_LOCK *lock, KLOCK_QUEUE_HANDLE *queue )
{
KSPIN_LOCK_QUEUE *tail;
......@@ -542,7 +542,7 @@ void WINAPI KeAcquireInStackQueuedSpinLockAtDpcLevel( KSPIN_LOCK *lock, KLOCK_QU
* KeReleaseInStackQueuedSpinLockFromDpcLevel (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER( KeReleaseInStackQueuedSpinLockFromDpcLevel )
void WINAPI KeReleaseInStackQueuedSpinLockFromDpcLevel( KLOCK_QUEUE_HANDLE *queue )
void FASTCALL KeReleaseInStackQueuedSpinLockFromDpcLevel( KLOCK_QUEUE_HANDLE *queue )
{
KSPIN_LOCK *lock = (KSPIN_LOCK *)((ULONG_PTR)queue->LockQueue.Lock & ~QUEUED_SPINLOCK_OWNED);
KSPIN_LOCK_QUEUE *next;
......@@ -629,7 +629,7 @@ void WINAPI IoReleaseCancelSpinLock( KIRQL irql )
* ExfInterlockedRemoveHeadList (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( ExfInterlockedRemoveHeadList, 8 )
PLIST_ENTRY WINAPI ExfInterlockedRemoveHeadList( LIST_ENTRY *list, KSPIN_LOCK *lock )
PLIST_ENTRY FASTCALL ExfInterlockedRemoveHeadList( LIST_ENTRY *list, KSPIN_LOCK *lock )
{
return ExInterlockedRemoveHeadList( list, lock );
}
......@@ -656,7 +656,7 @@ LIST_ENTRY * WINAPI ExInterlockedRemoveHeadList( LIST_ENTRY *list, KSPIN_LOCK *l
* InterlockedPopEntrySList (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER( NTOSKRNL_InterlockedPopEntrySList )
PSLIST_ENTRY WINAPI NTOSKRNL_InterlockedPopEntrySList( PSLIST_HEADER list )
PSLIST_ENTRY FASTCALL NTOSKRNL_InterlockedPopEntrySList( PSLIST_HEADER list )
{
return RtlInterlockedPopEntrySList( list );
}
......@@ -666,7 +666,7 @@ PSLIST_ENTRY WINAPI NTOSKRNL_InterlockedPopEntrySList( PSLIST_HEADER list )
* InterlockedPushEntrySList (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( NTOSKRNL_InterlockedPushEntrySList, 8 )
PSLIST_ENTRY WINAPI NTOSKRNL_InterlockedPushEntrySList( PSLIST_HEADER list, PSLIST_ENTRY entry )
PSLIST_ENTRY FASTCALL NTOSKRNL_InterlockedPushEntrySList( PSLIST_HEADER list, PSLIST_ENTRY entry )
{
return RtlInterlockedPushEntrySList( list, entry );
}
......@@ -676,7 +676,7 @@ PSLIST_ENTRY WINAPI NTOSKRNL_InterlockedPushEntrySList( PSLIST_HEADER list, PSLI
* ExInterlockedPopEntrySList (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( NTOSKRNL_ExInterlockedPopEntrySList, 8 )
PSLIST_ENTRY WINAPI NTOSKRNL_ExInterlockedPopEntrySList( PSLIST_HEADER list, PKSPIN_LOCK lock )
PSLIST_ENTRY FASTCALL NTOSKRNL_ExInterlockedPopEntrySList( PSLIST_HEADER list, PKSPIN_LOCK lock )
{
return RtlInterlockedPopEntrySList( list );
}
......@@ -686,7 +686,7 @@ PSLIST_ENTRY WINAPI NTOSKRNL_ExInterlockedPopEntrySList( PSLIST_HEADER list, PKS
* ExInterlockedPushEntrySList (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL_WRAPPER( NTOSKRNL_ExInterlockedPushEntrySList, 12 )
PSLIST_ENTRY WINAPI NTOSKRNL_ExInterlockedPushEntrySList( PSLIST_HEADER list, PSLIST_ENTRY entry, PKSPIN_LOCK lock )
PSLIST_ENTRY FASTCALL NTOSKRNL_ExInterlockedPushEntrySList( PSLIST_HEADER list, PSLIST_ENTRY entry, PKSPIN_LOCK lock )
{
return RtlInterlockedPushEntrySList( list, entry );
}
......@@ -696,7 +696,7 @@ PSLIST_ENTRY WINAPI NTOSKRNL_ExInterlockedPushEntrySList( PSLIST_HEADER list, PS
* ExInterlockedFlushSList (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER( NTOSKRNL_ExInterlockedFlushSList )
PSLIST_ENTRY WINAPI NTOSKRNL_ExInterlockedFlushSList( PSLIST_HEADER list )
PSLIST_ENTRY FASTCALL NTOSKRNL_ExInterlockedFlushSList( PSLIST_HEADER list )
{
return RtlInterlockedFlushSList( list );
}
......@@ -706,7 +706,7 @@ PSLIST_ENTRY WINAPI NTOSKRNL_ExInterlockedFlushSList( PSLIST_HEADER list )
* ExAcquireFastMutexUnsafe (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER(ExAcquireFastMutexUnsafe)
void WINAPI ExAcquireFastMutexUnsafe( FAST_MUTEX *mutex )
void FASTCALL ExAcquireFastMutexUnsafe( FAST_MUTEX *mutex )
{
LONG count;
......@@ -721,7 +721,7 @@ void WINAPI ExAcquireFastMutexUnsafe( FAST_MUTEX *mutex )
* ExReleaseFastMutexUnsafe (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER(ExReleaseFastMutexUnsafe)
void WINAPI ExReleaseFastMutexUnsafe( FAST_MUTEX *mutex )
void FASTCALL ExReleaseFastMutexUnsafe( FAST_MUTEX *mutex )
{
LONG count;
......@@ -1095,7 +1095,7 @@ void WINAPI ExReleaseResourceForThreadLite( ERESOURCE *resource, ERESOURCE_THREA
* ExReleaseResourceLite (NTOSKRNL.EXE.@)
*/
DEFINE_FASTCALL1_WRAPPER( ExReleaseResourceLite )
void WINAPI ExReleaseResourceLite( ERESOURCE *resource )
void FASTCALL ExReleaseResourceLite( ERESOURCE *resource )
{
ExReleaseResourceForThreadLite( resource, (ERESOURCE_THREAD)KeGetCurrentThread() );
}
......
......@@ -1528,7 +1528,7 @@ static inline void IoMarkIrpPending(IRP *irp)
#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
NTSTATUS WINAPI DbgQueryDebugFilterState(ULONG, ULONG);
void WINAPI ExAcquireFastMutexUnsafe(PFAST_MUTEX);
void FASTCALL ExAcquireFastMutexUnsafe(PFAST_MUTEX);
BOOLEAN WINAPI ExAcquireResourceExclusiveLite(ERESOURCE*,BOOLEAN);
BOOLEAN WINAPI ExAcquireResourceSharedLite(ERESOURCE*,BOOLEAN);
BOOLEAN WINAPI ExAcquireSharedStarveExclusive(ERESOURCE*,BOOLEAN);
......@@ -1551,7 +1551,7 @@ PSLIST_ENTRY WINAPI ExInterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY,PKSPI
LIST_ENTRY * WINAPI ExInterlockedRemoveHeadList(LIST_ENTRY*,KSPIN_LOCK*);
BOOLEAN WINAPI ExIsResourceAcquiredExclusiveLite(ERESOURCE*);
ULONG WINAPI ExIsResourceAcquiredSharedLite(ERESOURCE*);
void WINAPI ExReleaseFastMutexUnsafe(PFAST_MUTEX);
void FASTCALL ExReleaseFastMutexUnsafe(PFAST_MUTEX);
void WINAPI ExReleaseResourceForThreadLite(ERESOURCE*,ERESOURCE_THREAD);
ULONG WINAPI ExSetTimerResolution(ULONG,BOOLEAN);
......@@ -1593,6 +1593,7 @@ void WINAPI IoReleaseCancelSpinLock(KIRQL);
NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN);
NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
void FASTCALL KeAcquireInStackQueuedSpinLockAtDpcLevel(KSPIN_LOCK*,KLOCK_QUEUE_HANDLE*);
#ifdef __i386__
void WINAPI KeAcquireSpinLock(KSPIN_LOCK*,KIRQL*);
#else
......@@ -1615,6 +1616,7 @@ void WINAPI KeLeaveCriticalRegion(void);
void WINAPI KeQuerySystemTime(LARGE_INTEGER*);
void WINAPI KeQueryTickCount(LARGE_INTEGER*);
ULONG WINAPI KeQueryTimeIncrement(void);
void FASTCALL KeReleaseInStackQueuedSpinLockFromDpcLevel(KLOCK_QUEUE_HANDLE*);
LONG WINAPI KeReleaseMutex(PRKMUTEX,BOOLEAN);
LONG WINAPI KeReleaseSemaphore(PRKSEMAPHORE,KPRIORITY,LONG,BOOLEAN);
void WINAPI KeReleaseSpinLock(KSPIN_LOCK*,KIRQL);
......
......@@ -100,6 +100,12 @@ extern "C" {
# endif
#endif /* __cdecl */
#ifndef __fastcall
# ifndef _MSC_VER
# define __fastcall __stdcall
# endif
#endif
#ifndef __ms_va_list
# if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__)
# define __ms_va_list __builtin_ms_va_list
......
......@@ -65,7 +65,7 @@
/* fastcall support */
#ifdef __i386__
#if defined(__i386__) && !defined(_WIN32)
# define DEFINE_FASTCALL1_WRAPPER(func) \
__ASM_STDCALL_FUNC( __fastcall_ ## func, 4, \
......
......@@ -42,6 +42,7 @@ extern "C" {
#endif
#define NTAPI __stdcall
#define FASTCALL __fastcall
#ifndef MIDL_PASS
# if defined(_MSC_VER)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment