Author: tkreuzer
Date: Tue Jul 26 14:00:08 2011
New Revision: 52897
URL:
http://svn.reactos.org/svn/reactos?rev=52897&view=rev
Log:
[NTOSKRNL]
- Inline KeDisableInterrupts
- Make ExInterlocked* functions portable
Added:
trunk/reactos/ntoskrnl/ex/interlocked.c
- copied, changed from r52875, trunk/reactos/ntoskrnl/ex/i386/interlocked.c
Removed:
trunk/reactos/ntoskrnl/ex/amd64/
trunk/reactos/ntoskrnl/ex/fastinterlck.c
trunk/reactos/ntoskrnl/ex/i386/interlocked.c
Modified:
trunk/reactos/ntoskrnl/CMakeLists.txt
trunk/reactos/ntoskrnl/include/internal/amd64/ke.h
trunk/reactos/ntoskrnl/include/internal/arm/ke.h
trunk/reactos/ntoskrnl/include/internal/i386/ke.h
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/ke/arm/cpu.c
trunk/reactos/ntoskrnl/ke/i386/cpu.c
trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
Modified: trunk/reactos/ntoskrnl/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/CMakeLists.txt?re…
==============================================================================
--- trunk/reactos/ntoskrnl/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/CMakeLists.txt [iso-8859-1] Tue Jul 26 14:00:08 2011
@@ -83,12 +83,12 @@
ex/event.c
ex/evtpair.c
ex/exintrin.c
- ex/fastinterlck.c
ex/fmutex.c
ex/handle.c
ex/harderr.c
ex/hdlsterm.c
ex/init.c
+ ex/interlocked.c
ex/keyedevt.c
ex/locale.c
ex/lookas.c
@@ -277,7 +277,6 @@
list(APPEND SOURCE
config/i386/cmhardwr.c
ex/i386/fastinterlck_asm.S
- ex/i386/interlocked.c
ex/i386/ioport.S
ke/i386/abios.c
ke/i386/cpu.c
@@ -305,7 +304,6 @@
elseif(ARCH MATCHES amd64)
list(APPEND SOURCE
config/i386/cmhardwr.c
- ex/amd64/fastinterlck.c
ke/amd64/boot.S
ke/amd64/context.c
ke/amd64/cpu.c
Removed: trunk/reactos/ntoskrnl/ex/fastinterlck.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/fastinterlck.c…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/fastinterlck.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/fastinterlck.c (removed)
@@ -1,460 +1,0 @@
-/*
- * PROJECT: ReactOS Kernel
- * LICENSE: BSD - See COPYING.ARM in the top level directory
- * FILE: ntoskrnl/ex/fastinterlck.c
- * PURPOSE: Portable Ex*Interlocked and REGISTER routines for non-x86
- * PROGRAMMERS: ReactOS Portable Systems Group
- */
-
-/* INCLUDES *******************************************************************/
-
-#if defined(_ARM_) || defined(_PPC_) || defined(NTOS_USE_GENERICS)
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <debug.h>
-
-#undef ExInterlockedPushEntrySList
-#undef ExInterlockedPopEntrySList
-#undef ExInterlockedAddULong
-#undef ExInterlockedIncrementLong
-#undef ExInterlockedDecrementLong
-#undef ExInterlockedAddLargeStatistic
-
-/* FUNCTIONS ******************************************************************/
-
-PSLIST_ENTRY
-NTAPI
-InterlockedPushEntrySList(IN PSLIST_HEADER ListHead,
- IN PSLIST_ENTRY ListEntry)
-{
-
- PSINGLE_LIST_ENTRY FirstEntry, NextEntry;
- PSINGLE_LIST_ENTRY Entry = (PVOID)ListEntry, Head = (PVOID)ListHead;
-
- FirstEntry = Head->Next;
- do
- {
- Entry->Next = FirstEntry;
- NextEntry = FirstEntry;
- FirstEntry = (PVOID)_InterlockedCompareExchange((PLONG)Head,
- (LONG)Entry,
- (LONG)FirstEntry);
- } while (FirstEntry != NextEntry);
-
- return FirstEntry;
-}
-
-PSLIST_ENTRY
-NTAPI
-InterlockedPopEntrySList(IN PSLIST_HEADER ListHead)
-{
- PSINGLE_LIST_ENTRY FirstEntry, NextEntry, Head = (PVOID)ListHead;
-
- FirstEntry = Head->Next;
- do
- {
- if (!FirstEntry) return NULL;
-
- NextEntry = FirstEntry;
- FirstEntry = (PVOID)_InterlockedCompareExchange((PLONG)Head,
- (LONG)FirstEntry->Next,
- (LONG)FirstEntry);
- } while (FirstEntry != NextEntry);
-
- return FirstEntry;
-}
-
-PSINGLE_LIST_ENTRY
-FASTCALL
-ExInterlockedFlushSList(IN PSLIST_HEADER ListHead)
-{
- return (PVOID)_InterlockedExchange((PLONG)&ListHead->Next.Next, (LONG)NULL);
-}
-
-PSLIST_ENTRY
-FASTCALL
-ExInterlockedPushEntrySList(IN PSLIST_HEADER ListHead,
- IN PSLIST_ENTRY ListEntry,
- IN PKSPIN_LOCK Lock)
-{
- return InterlockedPushEntrySList(ListHead, ListEntry);
-}
-
-PSINGLE_LIST_ENTRY
-NTAPI
-ExInterlockedPopEntrySList(IN PSLIST_HEADER ListHead,
- IN PKSPIN_LOCK Lock)
-{
- return InterlockedPopEntrySList(ListHead);
-}
-
-ULONG
-FASTCALL
-ExfInterlockedAddUlong(IN PULONG Addend,
- IN ULONG Increment,
- PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- KeAcquireSpinLock(Lock, &OldIrql);
- *Addend += Increment;
- KeReleaseSpinLock(Lock, OldIrql);
- return *Addend;
-}
-
-LONGLONG
-FASTCALL
-ExfInterlockedCompareExchange64(IN OUT LONGLONG volatile *Destination,
- IN PLONGLONG Exchange,
- IN PLONGLONG Comparand)
-{
- LONGLONG Result;
-
- Result = *Destination;
- if (*Destination == *Comparand) *Destination = *Exchange;
- return Result;
-}
-
-PLIST_ENTRY
-FASTCALL
-ExfInterlockedInsertHeadList(IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY ListEntry,
- IN PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- PLIST_ENTRY OldHead = NULL;
- KeAcquireSpinLock(Lock, &OldIrql);
- if (!IsListEmpty(ListHead)) OldHead = ListEntry->Flink;
- InsertHeadList(ListHead, ListEntry);
- KeReleaseSpinLock(Lock, OldIrql);
- return OldHead;
-}
-
-PLIST_ENTRY
-FASTCALL
-ExfInterlockedInsertTailList(IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY ListEntry,
- IN PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- PLIST_ENTRY OldHead = NULL;
- KeAcquireSpinLock(Lock, &OldIrql);
- if (!IsListEmpty(ListHead)) OldHead = ListEntry->Blink;
- InsertTailList(ListHead, ListEntry);
- KeReleaseSpinLock(Lock, OldIrql);
- return OldHead;
-}
-
-PSINGLE_LIST_ENTRY
-FASTCALL
-ExfInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead,
- IN PKSPIN_LOCK Lock)
-{
- UNIMPLEMENTED;
- return NULL;
-}
-
-PSINGLE_LIST_ENTRY
-FASTCALL
-ExfInterlockedPushEntryList(IN PSINGLE_LIST_ENTRY ListHead,
- IN PSINGLE_LIST_ENTRY ListEntry,
- IN PKSPIN_LOCK Lock)
-{
- UNIMPLEMENTED;
- return NULL;
-}
-
-PLIST_ENTRY
-FASTCALL
-ExfInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead,
- IN PKSPIN_LOCK Lock)
-{
- return ExInterlockedRemoveHeadList(ListHead, Lock);
-}
-
-LARGE_INTEGER
-NTAPI
-ExInterlockedAddLargeInteger(IN PLARGE_INTEGER Addend,
- IN LARGE_INTEGER Increment,
- IN PKSPIN_LOCK Lock)
-{
- LARGE_INTEGER Integer = {{0}};
- UNIMPLEMENTED;
- return Integer;
-}
-
-ULONG
-NTAPI
-ExInterlockedAddUlong(IN PULONG Addend,
- IN ULONG Increment,
- PKSPIN_LOCK Lock)
-{
- return (ULONG)_InterlockedExchangeAdd((PLONG)Addend, Increment);
-}
-
-INTERLOCKED_RESULT
-NTAPI
-ExInterlockedIncrementLong(IN PLONG Addend,
- IN PKSPIN_LOCK Lock)
-{
- return _InterlockedIncrement(Addend);
-}
-
-INTERLOCKED_RESULT
-NTAPI
-ExInterlockedDecrementLong(IN PLONG Addend,
- IN PKSPIN_LOCK Lock)
-{
- return _InterlockedDecrement(Addend);
-}
-
-ULONG
-NTAPI
-ExInterlockedExchangeUlong(IN PULONG Target,
- IN ULONG Value,
- IN PKSPIN_LOCK Lock)
-{
- return (ULONG)_InterlockedExchange((PLONG)Target, Value);
-}
-
-PLIST_ENTRY
-NTAPI
-ExInterlockedInsertHeadList(IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY ListEntry,
- IN PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- PLIST_ENTRY OldHead = NULL;
- KeAcquireSpinLock(Lock, &OldIrql);
- if (!IsListEmpty(ListHead)) OldHead = ListEntry->Flink;
- InsertHeadList(ListHead, ListEntry);
- KeReleaseSpinLock(Lock, OldIrql);
- return OldHead;
-}
-
-PLIST_ENTRY
-NTAPI
-ExInterlockedInsertTailList(IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY ListEntry,
- IN PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- PLIST_ENTRY OldHead = NULL;
- KeAcquireSpinLock(Lock, &OldIrql);
- if (!IsListEmpty(ListHead)) OldHead = ListEntry->Blink;
- InsertTailList(ListHead, ListEntry);
- KeReleaseSpinLock(Lock, OldIrql);
- return OldHead;
-}
-
-PSINGLE_LIST_ENTRY
-NTAPI
-ExInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead,
- IN PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- PSINGLE_LIST_ENTRY OldHead = NULL;
- KeAcquireSpinLock(Lock, &OldIrql);
- OldHead = PopEntryList(ListHead);
- KeReleaseSpinLock(Lock, OldIrql);
- return OldHead;
-}
-
-PSINGLE_LIST_ENTRY
-NTAPI
-ExInterlockedPushEntryList(IN PSINGLE_LIST_ENTRY ListHead,
- IN PSINGLE_LIST_ENTRY ListEntry,
- IN PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- PSINGLE_LIST_ENTRY OldHead = NULL;
- KeAcquireSpinLock(Lock, &OldIrql);
- OldHead = ListHead->Next;
- PushEntryList(ListHead, ListEntry);
- KeReleaseSpinLock(Lock, OldIrql);
- return OldHead;
-}
-
-PLIST_ENTRY
-NTAPI
-ExInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead,
- IN PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- PLIST_ENTRY OldHead = NULL;
- KeAcquireSpinLock(Lock, &OldIrql);
- if (!IsListEmpty(ListHead)) OldHead = RemoveHeadList(ListHead);
- KeReleaseSpinLock(Lock, OldIrql);
- return OldHead;
-}
-
-VOID
-FASTCALL
-ExInterlockedAddLargeStatistic(IN PLONGLONG Addend,
- IN ULONG Increment)
-{
- UNIMPLEMENTED;
-}
-
-LONGLONG
-FASTCALL
-ExInterlockedCompareExchange64(IN OUT LONGLONG volatile *Destination,
- IN PLONGLONG Exchange,
- IN PLONGLONG Comparand,
- IN PKSPIN_LOCK Lock)
-{
- KIRQL OldIrql;
- LONGLONG Result;
-
- KeAcquireSpinLock(Lock, &OldIrql);
- Result = *Destination;
- if (*Destination == *Comparand) *Destination = *Exchange;
- KeReleaseSpinLock(Lock, OldIrql);
- return Result;
-}
-
-VOID
-NTAPI
-READ_REGISTER_BUFFER_UCHAR(IN PUCHAR Register,
- IN PUCHAR Buffer,
- IN ULONG Count)
-{
- PUCHAR registerBuffer = Register;
- PUCHAR readBuffer = Buffer;
- ULONG readCount;
-
- for (readCount = Count; readCount--; readBuffer++, registerBuffer++)
- {
- *readBuffer = *(volatile UCHAR * const)registerBuffer;
- }
-}
-
-VOID
-NTAPI
-READ_REGISTER_BUFFER_ULONG(IN PULONG Register,
- IN PULONG Buffer,
- IN ULONG Count)
-{
- PULONG registerBuffer = Register;
- PULONG readBuffer = Buffer;
- ULONG readCount;
-
- for (readCount = Count; readCount--; readBuffer++, registerBuffer++)
- {
- *readBuffer = *(volatile ULONG * const)registerBuffer;
- }
-}
-
-VOID
-NTAPI
-READ_REGISTER_BUFFER_USHORT(IN PUSHORT Register,
- IN PUSHORT Buffer,
- IN ULONG Count)
-{
- PUSHORT registerBuffer = Register;
- PUSHORT readBuffer = Buffer;
- ULONG readCount;
-
- for (readCount = Count; readCount--; readBuffer++, registerBuffer++)
- {
- *readBuffer = *(volatile USHORT * const)registerBuffer;
- }
-}
-
-UCHAR
-NTAPI
-READ_REGISTER_UCHAR(IN PUCHAR Register)
-{
- return *(volatile UCHAR * const)Register;
-}
-
-ULONG
-NTAPI
-READ_REGISTER_ULONG(IN PULONG Register)
-{
- return *(volatile ULONG * const)Register;
-}
-
-USHORT
-NTAPI
-READ_REGISTER_USHORT(IN PUSHORT Register)
-{
- return *(volatile USHORT * const)Register;
-}
-
-VOID
-NTAPI
-WRITE_REGISTER_BUFFER_UCHAR(IN PUCHAR Register,
- IN PUCHAR Buffer,
- IN ULONG Count)
-{
- PUCHAR registerBuffer = Register;
- PUCHAR writeBuffer = Buffer;
- ULONG writeCount;
- for (writeCount = Count; writeCount--; writeBuffer++, registerBuffer++)
- {
- *(volatile UCHAR * const)registerBuffer = *writeBuffer;
- }
- KeFlushWriteBuffer();
-}
-
-VOID
-NTAPI
-WRITE_REGISTER_BUFFER_ULONG(IN PULONG Register,
- IN PULONG Buffer,
- IN ULONG Count)
-{
- PULONG registerBuffer = Register;
- PULONG writeBuffer = Buffer;
- ULONG writeCount;
- for (writeCount = Count; writeCount--; writeBuffer++, registerBuffer++)
- {
- *(volatile ULONG * const)registerBuffer = *writeBuffer;
- }
- KeFlushWriteBuffer();
-}
-
-VOID
-NTAPI
-WRITE_REGISTER_BUFFER_USHORT(IN PUSHORT Register,
- IN PUSHORT Buffer,
- IN ULONG Count)
-{
- PUSHORT registerBuffer = Register;
- PUSHORT writeBuffer = Buffer;
- ULONG writeCount;
- for (writeCount = Count; writeCount--; writeBuffer++, registerBuffer++)
- {
- *(volatile USHORT * const)registerBuffer = *writeBuffer;
- }
- KeFlushWriteBuffer();
-}
-
-VOID
-NTAPI
-WRITE_REGISTER_UCHAR(IN PUCHAR Register,
- IN UCHAR Value)
-{
- *(volatile UCHAR * const)Register = Value;
- KeFlushWriteBuffer();
-}
-
-VOID
-NTAPI
-WRITE_REGISTER_ULONG(IN PULONG Register,
- IN ULONG Value)
-{
- *(volatile ULONG * const)Register = Value;
- KeFlushWriteBuffer();
-}
-
-VOID
-NTAPI
-WRITE_REGISTER_USHORT(IN PUSHORT Register,
- IN USHORT Value)
-{
- *(volatile USHORT * const)Register = Value;
- KeFlushWriteBuffer();
-}
-
-#endif
Removed: trunk/reactos/ntoskrnl/ex/i386/interlocked.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/i386/interlock…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/i386/interlocked.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/i386/interlocked.c (removed)
@@ -1,551 +1,0 @@
-/*
-* PROJECT: ReactOS Kernel
-* LICENSE: GPL - See COPYING in the top level directory
-* FILE: ntoskrnl/ex/interlocked.c
-* PURPOSE: Interlocked functions
-* PROGRAMMERS: Timo Kreuzer (timo.kreuzer(a)reactos.org)
-*/
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-
-#define NDEBUG
-#include <debug.h>
-
-#undef ExInterlockedAddUlong
-#undef ExInterlockedInsertHeadList
-#undef ExInterlockedInsertTailList
-#undef ExInterlockedRemoveHeadList
-#undef ExInterlockedPopEntryList
-#undef ExInterlockedPushEntryList
-#undef ExInterlockedIncrementLong
-#undef ExInterlockedDecrementLong
-#undef ExInterlockedExchangeUlong
-#undef ExInterlockedCompareExchange64
-
-
-/* FUNCTIONS ****************************************************************/
-
-#if defined(_M_IX86 ) || defined(_M_AMD64)
-FORCEINLINE
-ULONG_PTR
-_ExiDisableInteruptsAndAcquireSpinlock(
- IN OUT PKSPIN_LOCK Lock)
-{
- UINT_PTR EFlags;
-
- /* Save flags */
- EFlags = __readeflags();
-
- /* Disable interrupts */
- _disable();
-
- /* Acquire the spinlock (inline) */
- KxAcquireSpinLock(Lock);
-
- return EFlags;
-}
-
-FORCEINLINE
-VOID
-_ExiReleaseSpinLockAndRestoreInterupts(
- IN OUT PKSPIN_LOCK Lock,
- ULONG_PTR EFlags)
-{
- /* Release the spinlock */
- KxReleaseSpinLock(Lock);
-
- /* Restore flags */
- __writeeflags(EFlags);
-}
-#else
-#error Unimplemented
-#endif
-
-LARGE_INTEGER
-NTAPI
-ExInterlockedAddLargeInteger(
- IN OUT PLARGE_INTEGER Addend,
- IN LARGE_INTEGER Increment,
- IN OUT PKSPIN_LOCK Lock)
-{
- LARGE_INTEGER OldValue;
- ULONG_PTR LockHandle;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the old value */
- OldValue.QuadPart = Addend->QuadPart;
-
- /* Do the operation */
- Addend->QuadPart += Increment.QuadPart;
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the old value */
- return OldValue;
-}
-
-ULONG
-NTAPI
-ExInterlockedAddUlong(
- IN OUT PULONG Addend,
- IN ULONG Increment,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- ULONG OldValue;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the old value */
- OldValue = *Addend;
-
- /* Do the operation */
- *Addend += Increment;
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the old value */
- return OldValue;
-}
-
-PLIST_ENTRY
-NTAPI
-ExInterlockedInsertHeadList(
- IN OUT PLIST_ENTRY ListHead,
- IN OUT PLIST_ENTRY ListEntry,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PLIST_ENTRY FirstEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the first entry */
- FirstEntry = ListHead->Flink;
-
- /* Insert the new entry */
- InsertHeadList(ListHead, ListEntry);
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the old first entry or NULL for empty list */
- return (FirstEntry == ListHead) ? NULL : FirstEntry;
-}
-
-PLIST_ENTRY
-NTAPI
-ExInterlockedInsertTailList(
- IN OUT PLIST_ENTRY ListHead,
- IN OUT PLIST_ENTRY ListEntry,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PLIST_ENTRY LastEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the last entry */
- LastEntry = ListHead->Blink;
-
- /* Insert the new entry */
- InsertTailList(ListHead, ListEntry);
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the old last entry or NULL for empty list */
- return (LastEntry == ListHead) ? NULL : LastEntry;
-}
-
-PLIST_ENTRY
-NTAPI
-ExInterlockedRemoveHeadList(
- IN OUT PLIST_ENTRY ListHead,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PLIST_ENTRY ListEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Check if the list is empty */
- if (IsListEmpty(ListHead))
- {
- /* Return NULL */
- ListEntry = NULL;
- }
- else
- {
- /* Remove the first entry from the list head */
- ListEntry = RemoveHeadList(ListHead);
- }
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the entry */
- return ListEntry;
-}
-
-PSINGLE_LIST_ENTRY
-NTAPI
-ExInterlockedPopEntryList(
- IN OUT PSINGLE_LIST_ENTRY ListHead,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PSINGLE_LIST_ENTRY ListEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Pop the first entry from the list */
- ListEntry = PopEntryList(ListHead);
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the entry */
- return ListEntry;
-}
-
-PSINGLE_LIST_ENTRY
-NTAPI
-ExInterlockedPushEntryList(
- IN OUT PSINGLE_LIST_ENTRY ListHead,
- IN OUT PSINGLE_LIST_ENTRY ListEntry,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PSINGLE_LIST_ENTRY OldListEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the old top entry */
- OldListEntry = ListHead->Next;
-
- /* Push a new entry on the list */
- PushEntryList(ListHead, ListEntry);
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the entry */
- return OldListEntry;
-}
-
-INTERLOCKED_RESULT
-NTAPI
-ExInterlockedIncrementLong(
- IN PLONG Addend,
- IN PKSPIN_LOCK Lock)
-{
- LONG Result;
-
- Result = _InterlockedIncrement(Addend);
- return (Result < 0) ? ResultNegative :
- (Result > 0) ? ResultPositive :
- ResultZero;
-}
-
-INTERLOCKED_RESULT
-NTAPI
-ExInterlockedDecrementLong(
- IN PLONG Addend,
- IN PKSPIN_LOCK Lock)
-{
- LONG Result;
-
- Result = _InterlockedDecrement(Addend);
- return (Result < 0) ? ResultNegative :
- (Result > 0) ? ResultPositive :
- ResultZero;
-}
-
-ULONG
-NTAPI
-ExInterlockedExchangeUlong(
- IN PULONG Target,
- IN ULONG Value,
- IN PKSPIN_LOCK Lock)
-{
- return (ULONG)_InterlockedExchange((PLONG)Target, (LONG)Value);
-}
-
-#ifdef _M_IX86
-
-ULONG
-FASTCALL
-ExfInterlockedAddUlong(
- IN OUT PULONG Addend,
- IN ULONG Increment,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- ULONG OldValue;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the old value */
- OldValue = *Addend;
-
- /* Do the operation */
- *Addend += Increment;
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the old value */
- return OldValue;
-}
-
-PLIST_ENTRY
-FASTCALL
-ExfInterlockedInsertHeadList(
- IN OUT PLIST_ENTRY ListHead,
- IN PLIST_ENTRY ListEntry,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PLIST_ENTRY FirstEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the first entry */
- FirstEntry = ListHead->Flink;
-
- /* Insert the new entry */
- InsertHeadList(ListHead, ListEntry);
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the old first entry or NULL for empty list */
- return (FirstEntry == ListHead) ? NULL : FirstEntry;
-}
-
-PLIST_ENTRY
-FASTCALL
-ExfInterlockedInsertTailList(
- IN OUT PLIST_ENTRY ListHead,
- IN PLIST_ENTRY ListEntry,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PLIST_ENTRY LastEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the last entry */
- LastEntry = ListHead->Blink;
-
- /* Insert the new entry */
- InsertTailList(ListHead, ListEntry);
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* Return the old last entry or NULL for empty list */
- return (LastEntry == ListHead) ? NULL : LastEntry;
-}
-
-
-PLIST_ENTRY
-FASTCALL
-ExfInterlockedRemoveHeadList(
- IN OUT PLIST_ENTRY ListHead,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PLIST_ENTRY ListEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Check if the list is empty */
- if (IsListEmpty(ListHead))
- {
- /* Return NULL */
- ListEntry = NULL;
- }
- else
- {
- /* Remove the first entry from the list head */
- ListEntry = RemoveHeadList(ListHead);
- }
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* return the entry */
- return ListEntry;
-}
-
-PSINGLE_LIST_ENTRY
-FASTCALL
-ExfInterlockedPopEntryList(
- IN OUT PSINGLE_LIST_ENTRY ListHead,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PSINGLE_LIST_ENTRY ListEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Pop the first entry from the list */
- ListEntry = PopEntryList(ListHead);
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* return the entry */
- return ListEntry;
-}
-
-PSINGLE_LIST_ENTRY
-FASTCALL
-ExfInterlockedPushEntryList(
- IN OUT PSINGLE_LIST_ENTRY ListHead,
- IN PSINGLE_LIST_ENTRY ListEntry,
- IN OUT PKSPIN_LOCK Lock)
-{
- ULONG_PTR LockHandle;
- PSINGLE_LIST_ENTRY OldListEntry;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
-
- /* Save the old top entry */
- OldListEntry = ListHead->Next;
-
- /* Push a new entry on the list */
- PushEntryList(ListHead, ListEntry);
-
- /* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
-
- /* return the entry */
- return OldListEntry;
-}
-
-INTERLOCKED_RESULT
-NTAPI
-Exi386InterlockedIncrementLong(
- IN PLONG Addend)
-{
- LONG Result;
-
- Result = _InterlockedIncrement(Addend);
- return (Result < 0) ? ResultNegative :
- (Result > 0) ? ResultPositive :
- ResultZero;
-}
-
-INTERLOCKED_RESULT
-FASTCALL
-Exfi386InterlockedIncrementLong(
- IN OUT LONG volatile *Addend)
-{
- LONG Result;
-
- Result = _InterlockedIncrement(Addend);
- return (Result < 0) ? ResultNegative :
- (Result > 0) ? ResultPositive :
- ResultZero;
-}
-
-INTERLOCKED_RESULT
-NTAPI
-Exi386InterlockedDecrementLong(
- IN PLONG Addend)
-{
- LONG Result;
-
- Result = _InterlockedDecrement(Addend);
- return (Result < 0) ? ResultNegative :
- (Result > 0) ? ResultPositive :
- ResultZero;
-}
-
-INTERLOCKED_RESULT
-FASTCALL
-Exfi386InterlockedDecrementLong(
- IN OUT PLONG Addend)
-{
- LONG Result;
-
- Result = _InterlockedDecrement(Addend);
- return (Result < 0) ? ResultNegative :
- (Result > 0) ? ResultPositive :
- ResultZero;
-}
-
-LONG
-NTAPI
-Exi386InterlockedExchangeUlong(
- PLONG Target,
- LONG Exchange)
-{
- return _InterlockedExchange(Target, Exchange);
-}
-
-ULONG
-FASTCALL
-Exfi386InterlockedExchangeUlong(
- IN OUT PULONG Target,
- IN ULONG Exchange)
-{
- return _InterlockedExchange((PLONG)Target, Exchange);
-}
-
-LONGLONG
-FASTCALL
-ExInterlockedCompareExchange64(
- IN OUT LONGLONG volatile *Destination,
- IN PLONGLONG Exchange,
- IN PLONGLONG Comparand,
- IN PKSPIN_LOCK Lock)
-{
- return _InterlockedCompareExchange64(Destination, *Exchange, *Comparand);
-}
-
-LONGLONG
-FASTCALL
-ExfInterlockedCompareExchange64(
- IN OUT LONGLONG volatile *Destination,
- IN PLONGLONG Exchange,
- IN PLONGLONG Comparand)
-{
- return _InterlockedCompareExchange64(Destination, *Exchange, *Comparand);
-}
-#endif
-
-#if 0
-
-VOID
-FASTCALL
-ExInterlockedAddLargeStatistic(
- IN OUT PLARGE_INTEGER Addend,
- IN ULONG Increment)
-{
-}
-
-
-#endif
-
Copied: trunk/reactos/ntoskrnl/ex/interlocked.c (from r52875,
trunk/reactos/ntoskrnl/ex/i386/interlocked.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/interlocked.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/i386/interlocked.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/interlocked.c [iso-8859-1] Tue Jul 26 14:00:08 2011
@@ -27,41 +27,35 @@
/* FUNCTIONS ****************************************************************/
-#if defined(_M_IX86 ) || defined(_M_AMD64)
FORCEINLINE
-ULONG_PTR
+BOOLEAN
_ExiDisableInteruptsAndAcquireSpinlock(
IN OUT PKSPIN_LOCK Lock)
{
- UINT_PTR EFlags;
-
- /* Save flags */
- EFlags = __readeflags();
+ BOOLEAN Enabled;
/* Disable interrupts */
- _disable();
+ Enabled = KeDisableInterrupts();
/* Acquire the spinlock (inline) */
KxAcquireSpinLock(Lock);
- return EFlags;
+ return Enabled;
}
FORCEINLINE
VOID
_ExiReleaseSpinLockAndRestoreInterupts(
IN OUT PKSPIN_LOCK Lock,
- ULONG_PTR EFlags)
+ BOOLEAN Enable)
{
/* Release the spinlock */
KxReleaseSpinLock(Lock);
- /* Restore flags */
- __writeeflags(EFlags);
-}
-#else
-#error Unimplemented
-#endif
+ /* Restore interrupts */
+ KeRestoreInterrupts(Enable);
+}
+
LARGE_INTEGER
NTAPI
@@ -71,10 +65,10 @@
IN OUT PKSPIN_LOCK Lock)
{
LARGE_INTEGER OldValue;
- ULONG_PTR LockHandle;
-
- /* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ BOOLEAN Enable;
+
+ /* Disable interrupts and acquire the spinlock */
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the old value */
OldValue.QuadPart = Addend->QuadPart;
@@ -83,7 +77,7 @@
Addend->QuadPart += Increment.QuadPart;
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the old value */
return OldValue;
@@ -96,11 +90,11 @@
IN ULONG Increment,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
ULONG OldValue;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the old value */
OldValue = *Addend;
@@ -109,7 +103,7 @@
*Addend += Increment;
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the old value */
return OldValue;
@@ -122,11 +116,11 @@
IN OUT PLIST_ENTRY ListEntry,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PLIST_ENTRY FirstEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the first entry */
FirstEntry = ListHead->Flink;
@@ -135,7 +129,7 @@
InsertHeadList(ListHead, ListEntry);
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the old first entry or NULL for empty list */
return (FirstEntry == ListHead) ? NULL : FirstEntry;
@@ -148,11 +142,11 @@
IN OUT PLIST_ENTRY ListEntry,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PLIST_ENTRY LastEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the last entry */
LastEntry = ListHead->Blink;
@@ -161,7 +155,7 @@
InsertTailList(ListHead, ListEntry);
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the old last entry or NULL for empty list */
return (LastEntry == ListHead) ? NULL : LastEntry;
@@ -173,11 +167,11 @@
IN OUT PLIST_ENTRY ListHead,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PLIST_ENTRY ListEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Check if the list is empty */
if (IsListEmpty(ListHead))
@@ -192,7 +186,7 @@
}
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the entry */
return ListEntry;
@@ -204,17 +198,17 @@
IN OUT PSINGLE_LIST_ENTRY ListHead,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PSINGLE_LIST_ENTRY ListEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Pop the first entry from the list */
ListEntry = PopEntryList(ListHead);
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the entry */
return ListEntry;
@@ -227,11 +221,11 @@
IN OUT PSINGLE_LIST_ENTRY ListEntry,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PSINGLE_LIST_ENTRY OldListEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the old top entry */
OldListEntry = ListHead->Next;
@@ -240,7 +234,7 @@
PushEntryList(ListHead, ListEntry);
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the entry */
return OldListEntry;
@@ -293,11 +287,11 @@
IN ULONG Increment,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
ULONG OldValue;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the old value */
OldValue = *Addend;
@@ -306,7 +300,7 @@
*Addend += Increment;
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the old value */
return OldValue;
@@ -319,11 +313,11 @@
IN PLIST_ENTRY ListEntry,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PLIST_ENTRY FirstEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the first entry */
FirstEntry = ListHead->Flink;
@@ -332,7 +326,7 @@
InsertHeadList(ListHead, ListEntry);
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the old first entry or NULL for empty list */
return (FirstEntry == ListHead) ? NULL : FirstEntry;
@@ -345,11 +339,11 @@
IN PLIST_ENTRY ListEntry,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PLIST_ENTRY LastEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the last entry */
LastEntry = ListHead->Blink;
@@ -358,7 +352,7 @@
InsertTailList(ListHead, ListEntry);
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* Return the old last entry or NULL for empty list */
return (LastEntry == ListHead) ? NULL : LastEntry;
@@ -371,11 +365,11 @@
IN OUT PLIST_ENTRY ListHead,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PLIST_ENTRY ListEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Check if the list is empty */
if (IsListEmpty(ListHead))
@@ -390,7 +384,7 @@
}
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* return the entry */
return ListEntry;
@@ -402,17 +396,17 @@
IN OUT PSINGLE_LIST_ENTRY ListHead,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PSINGLE_LIST_ENTRY ListEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Pop the first entry from the list */
ListEntry = PopEntryList(ListHead);
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* return the entry */
return ListEntry;
@@ -425,11 +419,11 @@
IN PSINGLE_LIST_ENTRY ListEntry,
IN OUT PKSPIN_LOCK Lock)
{
- ULONG_PTR LockHandle;
+ BOOLEAN Enable;
PSINGLE_LIST_ENTRY OldListEntry;
/* Disable interrupts and acquire the spinlock */
- LockHandle = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
+ Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock);
/* Save the old top entry */
OldListEntry = ListHead->Next;
@@ -438,7 +432,7 @@
PushEntryList(ListHead, ListEntry);
/* Release the spinlock and restore interrupts */
- _ExiReleaseSpinLockAndRestoreInterupts(Lock, LockHandle);
+ _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable);
/* return the entry */
return OldListEntry;
Modified: trunk/reactos/ntoskrnl/include/internal/amd64/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] Tue Jul 26 14:00:08
2011
@@ -133,6 +133,31 @@
//
#define KeGetTrapFrameInterruptState(TrapFrame) \
BooleanFlagOn((TrapFrame)->EFlags, EFLAGS_INTERRUPT_MASK)
+
+/* Diable interrupts and return whether they were enabled before */
+BOOLEAN
+NTAPI
+KeDisableInterrupts(VOID)
+{
+ ULONG Flags;
+ BOOLEAN Return;
+
+ /* Get EFLAGS and check if the interrupt bit is set */
+ Flags = __readeflags();
+ Return = (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE: FALSE;
+
+ /* Disable interrupts */
+ _disable();
+ return Return;
+}
+
+/* Restore previous interrupt state */
+FORCEINLINE
+VOID
+KeRestoreInterrupts(BOOLEAN WereEnabled)
+{
+ if (WereEnabled) _enable();
+}
//
// Invalidates the TLB entry for a specified address
Modified: trunk/reactos/ntoskrnl/include/internal/arm/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] Tue Jul 26 14:00:08
2011
@@ -65,6 +65,31 @@
//
//#define KeGetTrapFrameInterruptState(TrapFrame)
+FORCEINLINE
+BOOLEAN
+KeDisableInterrupts(VOID)
+{
+ ARM_STATUS_REGISTER Flags;
+
+ //
+ // Get current interrupt state and disable interrupts
+ //
+ Flags = KeArmStatusRegisterGet();
+ _disable();
+
+ //
+ // Return previous interrupt state
+ //
+ return Flags.IrqDisable;
+}
+
+FORCEINLINE
+VOID
+KeRestoreInterrupts(BOOLEAN WereEnabled)
+{
+ if (WereEnabled) _enable();
+}
+
//
// Invalidates the TLB entry for a specified address
//
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Tue Jul 26 14:00:08
2011
@@ -163,6 +163,31 @@
FX_SAVE_AREA NpxArea;
KV86_FRAME V86Frame;
} KV8086_STACK_FRAME, *PKV8086_STACK_FRAME;
+
+/* Diable interrupts and return whether they were enabled before */
+FORCEINLINE
+BOOLEAN
+KeDisableInterrupts(VOID)
+{
+ ULONG Flags;
+ BOOLEAN Return;
+
+ /* Get EFLAGS and check if the interrupt bit is set */
+ Flags = __readeflags();
+ Return = (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE: FALSE;
+
+ /* Disable interrupts */
+ _disable();
+ return Return;
+}
+
+/* Restore previous interrupt state */
+FORCEINLINE
+VOID
+KeRestoreInterrupts(BOOLEAN WereEnabled)
+{
+ if (WereEnabled) _enable();
+}
//
// Registers an interrupt handler with an IDT vector
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Tue Jul 26 14:00:08 2011
@@ -1033,12 +1033,6 @@
NTAPI
KeThawExecution(IN BOOLEAN Enable);
-BOOLEAN
-NTAPI
-KeDisableInterrupts(
- VOID
-);
-
VOID
FASTCALL
KeAcquireQueuedSpinLockAtDpcLevel(
Modified: trunk/reactos/ntoskrnl/ke/arm/cpu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/cpu.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/cpu.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/cpu.c [iso-8859-1] Tue Jul 26 14:00:08 2011
@@ -90,23 +90,6 @@
return TRUE;
}
-BOOLEAN
-NTAPI
-KeDisableInterrupts(VOID)
-{
- ARM_STATUS_REGISTER Flags;
-
- //
- // Get current interrupt state and disable interrupts
- //
- Flags = KeArmStatusRegisterGet();
- _disable();
-
- //
- // Return previous interrupt state
- //
- return Flags.IrqDisable;
-}
/* PUBLIC FUNCTIONS ***********************************************************/
@@ -130,17 +113,17 @@
IN BOOLEAN AllProcessors)
{
KIRQL OldIrql;
-
+
//
// Raise the IRQL for the TB Flush
//
OldIrql = KeRaiseIrqlToSynchLevel();
-
+
//
// Flush the TB for the Current CPU
//
KeFlushCurrentTb();
-
+
//
// Return to Original IRQL
//
@@ -168,7 +151,7 @@
KeQueryActiveProcessors(VOID)
{
PAGED_CODE();
-
+
//
// Simply return the number of active processors
//
@@ -186,7 +169,7 @@
// Capture the context
//
RtlCaptureContext(&State->ContextFrame);
-
+
//
// Capture the control state
//
Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] Tue Jul 26 14:00:08 2011
@@ -1175,22 +1175,6 @@
BOOLEAN
NTAPI
-KeDisableInterrupts(VOID)
-{
- ULONG Flags;
- BOOLEAN Return;
-
- /* Get EFLAGS and check if the interrupt bit is set */
- Flags = __readeflags();
- Return = (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE: FALSE;
-
- /* Disable interrupts */
- _disable();
- return Return;
-}
-
-BOOLEAN
-NTAPI
KeInvalidateAllCaches(VOID)
{
/* Only supported on Pentium Pro and higher */
Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Tue Jul 26 14:00:08 2011
@@ -218,14 +218,8 @@
<directory name="ex">
<if property="ARCH" value="i386">
<directory name="i386">
- <file>interlocked.c</file>
<file>fastinterlck_asm.S</file>
<file>ioport.S</file>
- </directory>
- </if>
- <if property="ARCH" value="amd64">
- <directory name="amd64">
- <file>fastinterlck.c</file>
</directory>
</if>
<file>atom.c</file>
@@ -235,12 +229,12 @@
<file>event.c</file>
<file>evtpair.c</file>
<file>exintrin.c</file>
- <file>fastinterlck.c</file>
<file>fmutex.c</file>
<file>handle.c</file>
<file>harderr.c</file>
<file>hdlsterm.c</file>
<file>init.c</file>
+ <file>interlocked.c</file>
<file>keyedevt.c</file>
<file>locale.c</file>
<file>lookas.c</file>