[NTOSKRNL]

Patch by Thomas Faber:
Fix broken interlocked functions

See issue #6374 for more details.

svn path=/trunk/; revision=52735
This commit is contained in:
Timo Kreuzer 2011-07-20 13:48:06 +00:00
parent bbbb4ccf95
commit 825444af66
4 changed files with 32 additions and 27 deletions

View file

@ -155,8 +155,8 @@ PUBLIC @ExfInterlockedInsertHeadList@12
/*PLIST_ENTRY /*PLIST_ENTRY
*FASTCALL *FASTCALL
*ExfInterlockedInsertTailList(IN PLIST_ENTRY ListHead, *ExfInterlockedInsertTailList(IN PLIST_ENTRY ListHead,
* IN PLIST_ENTRY ListEntry, * IN PLIST_ENTRY ListEntry,
* IN PKSPIN_LOCK Lock) * IN PKSPIN_LOCK Lock)
*/ */
PUBLIC @ExfInterlockedInsertTailList@12 PUBLIC @ExfInterlockedInsertTailList@12
@ExfInterlockedInsertTailList@12: @ExfInterlockedInsertTailList@12:
@ -537,7 +537,7 @@ PUBLIC @Exfi386InterlockedDecrementLong@4
/*ULONG /*ULONG
*FASTCALL *FASTCALL
*Exfi386InterlockedExchangeUlong(IN PULONG Taget, *Exfi386InterlockedExchangeUlong(IN PULONG Target,
* IN ULONG Value) * IN ULONG Value)
*/ */
PUBLIC @Exfi386InterlockedExchangeUlong@8 PUBLIC @Exfi386InterlockedExchangeUlong@8
@ -591,16 +591,16 @@ PUBLIC @ExfInterlockedCompareExchange64@12
/*PVOID /*PVOID
*FASTCALL *FASTCALL
*ExfInterlockedCompareExchange64(IN PLONGLONG Destination, *ExInterlockedCompareExchange64(IN PLONGLONG Destination,
* IN PLONGLONG Exchange, * IN PLONGLONG Exchange,
* IN PLONGLONG Comperand, * IN PLONGLONG Comperand,
* IN PKSPIN_LOCK Lock) * IN PKSPIN_LOCK Lock)
*/ */
PUBLIC @ExInterlockedCompareExchange64@16 PUBLIC @ExInterlockedCompareExchange64@16
@ExInterlockedCompareExchange64@16: @ExInterlockedCompareExchange64@16:
/* Save registers */ /* Save registers */
push ebp push ebx
push ebp push ebp
/* Get destination pointer, exchange value and comperand value/address */ /* Get destination pointer, exchange value and comperand value/address */

View file

@ -5,7 +5,7 @@
* PURPOSE: STDCALL Interlocked Functions * PURPOSE: STDCALL Interlocked Functions
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net) * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
*/ */
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <asm.inc> #include <asm.inc>
@ -26,8 +26,8 @@
/*PLIST_ENTRY /*PLIST_ENTRY
*NTAPI *NTAPI
*ExInterlockedAddLargeInteger(IN PLIST_ENTRY ListHead, *ExInterlockedAddLargeInteger(IN PLARGE_INTEGER Addend,
* IN PLIST_ENTRY ListEntry, * IN LARGE_INTEGER Increment,
* IN PKSPIN_LOCK Lock) * IN PKSPIN_LOCK Lock)
*/ */
PUBLIC _ExInterlockedAddLargeInteger@16 PUBLIC _ExInterlockedAddLargeInteger@16
@ -92,9 +92,9 @@ _ExInterlockedAddLargeInteger@16:
/*PLIST_ENTRY /*PLIST_ENTRY
*NTAPI *NTAPI
*ExInterlockedInsertHeadList(IN PLIST_ENTRY ListHead, *ExInterlockedAddUlong(IN PULONG Addend,
* IN PLIST_ENTRY ListEntry, * IN ULONG Increment,
* IN PKSPIN_LOCK Lock) * IN PKSPIN_LOCK Lock)
*/ */
PUBLIC _ExInterlockedAddUlong@12 PUBLIC _ExInterlockedAddUlong@12
_ExInterlockedAddUlong@12: _ExInterlockedAddUlong@12:
@ -471,14 +471,18 @@ _ExInterlockedDecrementLong@8:
PUBLIC _ExInterlockedExchangeUlong@12 PUBLIC _ExInterlockedExchangeUlong@12
_ExInterlockedExchangeUlong@12: _ExInterlockedExchangeUlong@12:
#ifdef CONFIG_SMP
/* Get pointers */ /* Get pointers */
mov edx, [esp+4] mov edx, [esp+4]
mov eax, [esp+8] mov eax, [esp+8]
#ifdef CONFIG_SMP
/* On MP, do the exchange */ /* On MP, do the exchange */
xchg [edx], eax xchg [edx], eax
#else #else
/* Get pointers */
mov edx, [esp+4]
mov ecx, [esp+8]
/* On UP, disable interrupts and save flags */ /* On UP, disable interrupts and save flags */
pushfd pushfd
cli cli
@ -494,8 +498,7 @@ _ExInterlockedExchangeUlong@12:
/*INTERLOCKED_RESULT /*INTERLOCKED_RESULT
*NTAPI *NTAPI
*Exi386InterlockedIncrementLong(IN PLONG Addend, *Exi386InterlockedIncrementLong(IN PLONG Addend)
* IN PKSPIN_LOCK Lock)
*/ */
PUBLIC _Exi386InterlockedIncrementLong@4 PUBLIC _Exi386InterlockedIncrementLong@4
_Exi386InterlockedIncrementLong@4: _Exi386InterlockedIncrementLong@4:
@ -513,8 +516,7 @@ _Exi386InterlockedIncrementLong@4:
/*INTERLOCKED_RESULT /*INTERLOCKED_RESULT
*NTAPI *NTAPI
*Exi386InterlockedDecrementLong(IN PLONG Addend, *Exi386InterlockedDecrementLong(IN PLONG Addend)
* IN PKSPIN_LOCK Lock)
*/ */
PUBLIC _Exi386InterlockedDecrementLong@4 PUBLIC _Exi386InterlockedDecrementLong@4
_Exi386InterlockedDecrementLong@4: _Exi386InterlockedDecrementLong@4:
@ -528,25 +530,28 @@ _Exi386InterlockedDecrementLong@4:
/* Return */ /* Return */
lahf lahf
and eax, EFLAG_SELECT and eax, EFLAG_SELECT
ret 8 ret 4
/*ULONG /*ULONG
*NTAPI *NTAPI
*Exi386InterlockedExchangeUlong(IN PULONG Target, *Exi386InterlockedExchangeUlong(IN PULONG Target,
* IN ULONG Value, * IN ULONG Value)
* IN PKSPIN_LOCK Lock)
*/ */
PUBLIC _Exi386InterlockedExchangeUlong@12 PUBLIC _Exi386InterlockedExchangeUlong@8
_Exi386InterlockedExchangeUlong@12: _Exi386InterlockedExchangeUlong@8:
#ifdef CONFIG_SMP
/* Get pointers */ /* Get pointers */
mov edx, [esp+4] mov edx, [esp+4]
mov eax, [esp+8] mov eax, [esp+8]
#ifdef CONFIG_SMP
/* On MP, do the exchange */ /* On MP, do the exchange */
xchg [edx], eax xchg [edx], eax
#else #else
/* Get pointers */
mov edx, [esp+4]
mov ecx, [esp+8]
/* On UP, disable interrupts and save flags */ /* On UP, disable interrupts and save flags */
pushfd pushfd
cli cli

View file

@ -198,7 +198,7 @@
@ FASTCALL -arch=i386 Exfi386InterlockedExchangeUlong(ptr long) @ FASTCALL -arch=i386 Exfi386InterlockedExchangeUlong(ptr long)
@ FASTCALL -arch=i386 Exfi386InterlockedIncrementLong(ptr) @ FASTCALL -arch=i386 Exfi386InterlockedIncrementLong(ptr)
@ stdcall -arch=i386 Exi386InterlockedDecrementLong(ptr) @ stdcall -arch=i386 Exi386InterlockedDecrementLong(ptr)
@ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long long) @ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long)
@ stdcall -arch=i386 Exi386InterlockedIncrementLong(ptr) @ stdcall -arch=i386 Exi386InterlockedIncrementLong(ptr)
@ FASTCALL -arch=i386 ExiAcquireFastMutex(ptr) ExAcquireFastMutex @ FASTCALL -arch=i386 ExiAcquireFastMutex(ptr) ExAcquireFastMutex
@ FASTCALL -arch=i386 ExiReleaseFastMutex(ptr) ExReleaseFastMutex @ FASTCALL -arch=i386 ExiReleaseFastMutex(ptr) ExReleaseFastMutex

View file

@ -178,7 +178,7 @@
@ fastcall -arch=i386 Exfi386InterlockedExchangeUlong(ptr long) @ fastcall -arch=i386 Exfi386InterlockedExchangeUlong(ptr long)
@ fastcall -arch=i386 Exfi386InterlockedIncrementLong(ptr) @ fastcall -arch=i386 Exfi386InterlockedIncrementLong(ptr)
@ stdcall -arch=i386 Exi386InterlockedDecrementLong(ptr) @ stdcall -arch=i386 Exi386InterlockedDecrementLong(ptr)
@ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long long) @ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long)
@ stdcall -arch=i386 Exi386InterlockedIncrementLong(ptr) @ stdcall -arch=i386 Exi386InterlockedIncrementLong(ptr)
@ fastcall -arch=i386 ExiAcquireFastMutex(ptr) ExAcquireFastMutex @ fastcall -arch=i386 ExiAcquireFastMutex(ptr) ExAcquireFastMutex
@ fastcall -arch=i386 ExiReleaseFastMutex(ptr) ExReleaseFastMutex @ fastcall -arch=i386 ExiReleaseFastMutex(ptr) ExReleaseFastMutex