Author: tkreuzer
Date: Tue Feb 10 18:38:42 2009
New Revision: 39544
URL:
http://svn.reactos.org/svn/reactos?rev=39544&view=rev
Log:
- Add an own fastinterlck.c for amd64
- Don't compile the generic interlocked functions
- Implement ExQueryDepthSList and add it to exports
- replace a bunch of #ifdefs with -arch=...
Added:
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/ (with props)
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/fastinterlck.c (with props)
Modified:
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/fastinterlck.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/stubs.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild
branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl.pspec
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Tue Feb 10 18:38:42 2009
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/fastinterlck.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/fastinterlck.c (added)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/fastinterlck.c [iso-8859-1] Tue
Feb 10 18:38:42 2009
@@ -1,0 +1,137 @@
+/*
+ * 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 amd64
+ * PROGRAMMERS: ReactOS Portable Systems Group
+ * Timo Kreuzer
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+#undef ExInterlockedAddLargeInteger
+#undef ExInterlockedAddUlong
+#undef ExInterlockedExtendZone
+#undef ExInterlockedInsertHeadList
+#undef ExInterlockedInsertTailList
+#undef ExInterlockedPopEntryList
+#undef ExInterlockedPushEntryList
+#undef ExInterlockedRemoveHeadList
+#undef ExpInterlockedFlushSList
+#undef ExpInterlockedPopEntrySList
+#undef ExpInterlockedPushEntrySList
+
+/* FUNCTIONS ******************************************************************/
+
+LARGE_INTEGER
+ExInterlockedAddLargeInteger(IN PLARGE_INTEGER Addend,
+ IN LARGE_INTEGER Increment,
+ IN PKSPIN_LOCK Lock)
+{
+ LARGE_INTEGER Int;
+ Int.QuadPart = _InterlockedExchangeAdd64(&Addend->QuadPart,
+ Increment.QuadPart);
+ return Int;
+}
+
+ULONG
+ExInterlockedAddUlong(IN PULONG Addend,
+ IN ULONG Increment,
+ PKSPIN_LOCK Lock)
+{
+ return (ULONG)_InterlockedExchangeAdd((PLONG)Addend, Increment);
+}
+
+PLIST_ENTRY
+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
+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
+ExInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead,
+ IN PKSPIN_LOCK Lock)
+{
+ KIRQL OldIrql;
+ PSINGLE_LIST_ENTRY OldHead = NULL;
+ KeAcquireSpinLock(Lock, &OldIrql);
+ if (!ListHead->Next) OldHead = PopEntryList(ListHead);
+ KeReleaseSpinLock(Lock, OldIrql);
+ return OldHead;
+}
+
+PSINGLE_LIST_ENTRY
+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);
+ if (!ListHead->Next) OldHead = PushEntryList(ListHead, ListEntry);
+ KeReleaseSpinLock(Lock, OldIrql);
+ return OldHead;
+}
+
+PLIST_ENTRY
+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;
+}
+
+PSLIST_ENTRY
+ExpInterlockedFlushSList(
+ PSLIST_HEADER ListHead)
+{
+ UNIMPLEMENTED;
+ return NULL;
+}
+
+PSLIST_ENTRY
+ExpInterlockedPopEntrySList(
+ IN PSLIST_HEADER ListHead)
+{
+ UNIMPLEMENTED;
+ return NULL;
+}
+
+PSLIST_ENTRY
+ExpInterlockedPushEntrySList(
+ PSLIST_HEADER ListHead,
+ PSLIST_ENTRY ListEntry)
+{
+ UNIMPLEMENTED;
+ return NULL;
+}
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/amd64/fastinterlck.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/fastinterlck.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ex/fastinterlck.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ex/fastinterlck.c [iso-8859-1] Tue Feb 10
18:38:42 2009
@@ -8,7 +8,7 @@
/* INCLUDES *******************************************************************/
-#if defined(_ARM_) || defined(_PPC_) || defined(_M_AMD64) || defined(NTOS_USE_GENERICS)
+#if defined(_ARM_) || defined(_PPC_) || defined(NTOS_USE_GENERICS)
#include <ntoskrnl.h>
#define NDEBUG
@@ -311,7 +311,6 @@
return Result;
}
-#ifndef _M_AMD64
VOID
NTAPI
READ_REGISTER_BUFFER_UCHAR(IN PUCHAR Register,
@@ -455,6 +454,5 @@
*(volatile USHORT * const)Register = Value;
KeFlushWriteBuffer();
}
-#endif // !_M_AMD64
#endif
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/stubs.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/stubs.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/stubs.c [iso-8859-1] Tue Feb 10
18:38:42 2009
@@ -160,15 +160,6 @@
return STATUS_UNSUCCESSFUL;
}
-NTKERNELAPI
-PSLIST_ENTRY
-ExpInterlockedFlushSList(
- PSLIST_HEADER ListHead)
-{
- UNIMPLEMENTED;
- return NULL;
-}
-
NTSTATUS
NTAPI
KiCallUserMode(
@@ -179,3 +170,10 @@
return STATUS_UNSUCCESSFUL;
}
+#undef ExQueryDepthSList
+NTKERNELAPI
+USHORT
+ExQueryDepthSList(IN PSLIST_HEADER ListHead)
+{
+ return (USHORT)(ListHead->Alignment & 0xffff);
+}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Tue
Feb 10 18:38:42 2009
@@ -197,6 +197,11 @@
<file>interlck_asm.S</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>
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl.pspec
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl.pspec [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl.pspec [iso-8859-1] Tue Feb 10
18:38:42 2009
@@ -55,9 +55,7 @@
@ stdcall DbgPrompt(str ptr long)
@ stdcall DbgQueryDebugFilterState(long long)
@ stdcall DbgSetDebugFilterState(long long long)
-#ifdef __x86_64__
-@ fastcall ExAcquireFastMutex(ptr)
-#endif
+@ fastcall -arch=x86_64 ExAcquireFastMutex(ptr)
@ fastcall ExAcquireFastMutexUnsafe(ptr)
@ stdcall ExAcquireResourceExclusiveLite(ptr long)
@ stdcall ExAcquireResourceSharedLite(ptr long)
@@ -134,6 +132,7 @@
@ stdcall ExIsResourceAcquiredSharedLite(ptr)
@ stdcall ExLocalTimeToSystemTime(ptr ptr)
@ stdcall ExNotifyCallback(ptr ptr ptr)
+@ stdcall -arch=x86_64 ExQueryDepthSList(ptr)
@ stdcall ExQueryPoolBlockSize(ptr ptr)
@ stdcall ExQueueWorkItem(ptr long)
@ stdcall ExRaiseAccessViolation()
@@ -145,9 +144,7 @@
@ fastcall ExReInitializeRundownProtectionCacheAware(ptr)
ExfReInitializeRundownProtectionCacheAware
@ stdcall ExRegisterCallback(ptr ptr ptr)
@ stdcall ExReinitializeResourceLite(ptr)
-#ifdef __x86_64__
-@ fastcall ExReleaseFastMutex(ptr)
-#endif
+@ fastcall -arch=x86_64 ExReleaseFastMutex(ptr)
@ fastcall ExReleaseFastMutexUnsafe(ptr)
@ fastcall ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(ptr)
@ fastcall ExReleaseResourceAndLeaveCriticalRegion(ptr)
@@ -165,9 +162,7 @@
@ stdcall ExSizeOfRundownProtectionCacheAware()
@ stdcall ExSystemExceptionFilter()
@ stdcall ExSystemTimeToLocalTime(ptr ptr)
-#ifdef __x86_64__
-@ fastcall ExTryToAcquireFastMutex(ptr)
-#endif
+@ fastcall -arch=x86_64 ExTryToAcquireFastMutex(ptr)
@ stdcall ExUnregisterCallback(ptr)
@ stdcall ExUuidCreate(ptr)
@ stdcall ExVerifySuite(long)
@@ -190,24 +185,18 @@
@ fastcall ExfReleasePushLockShared(ptr)
@ fastcall ExfTryToWakePushLock(ptr)
@ fastcall ExfUnblockPushLock(ptr ptr)
-#ifdef __x86_64__
-@ stdcall ExpInterlockedFlushSList(ptr)
-@ stdcall ExpInterlockedPopEntrySList(ptr ptr)
-@ stdcall ExpInterlockedPushEntrySList(ptr ptr)
-#endif
-#ifdef _M_IX86
-@ fastcall Exfi386InterlockedDecrementLong(ptr)
-@ fastcall Exfi386InterlockedExchangeUlong(ptr long)
-@ fastcall Exfi386InterlockedIncrementLong(ptr)
-@ stdcall Exi386InterlockedDecrementLong(ptr)
-@ stdcall Exi386InterlockedExchangeUlong(ptr long long)
-@ stdcall Exi386InterlockedIncrementLong(ptr)
-#endif
-#ifdef _M_IX86
-@ fastcall ExiAcquireFastMutex(ptr) ExAcquireFastMutex
-@ fastcall ExiReleaseFastMutex(ptr) ExReleaseFastMutex
-@ fastcall ExiTryToAcquireFastMutex(ptr) ExTryToAcquireFastMutex
-#endif
+@ stdcall -arch=x86_64 ExpInterlockedFlushSList(ptr)
+@ stdcall -arch=x86_64 ExpInterlockedPopEntrySList(ptr ptr)
+@ stdcall -arch=x86_64 ExpInterlockedPushEntrySList(ptr ptr)
+@ fastcall -arch=i386 Exfi386InterlockedDecrementLong(ptr)
+@ fastcall -arch=i386 Exfi386InterlockedExchangeUlong(ptr long)
+@ fastcall -arch=i386 Exfi386InterlockedIncrementLong(ptr)
+@ stdcall -arch=i386 Exi386InterlockedDecrementLong(ptr)
+@ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long long)
+@ stdcall -arch=i386 Exi386InterlockedIncrementLong(ptr)
+@ fastcall -arch=i386 ExiAcquireFastMutex(ptr) ExAcquireFastMutex
+@ fastcall -arch=i386 ExiReleaseFastMutex(ptr) ExReleaseFastMutex
+@ fastcall -arch=i386 ExiTryToAcquireFastMutex(ptr) ExTryToAcquireFastMutex
@ stdcall FsRtlAcquireFileExclusive(ptr)
;FsRtlAddBaseMcbEntry
@ stdcall FsRtlAddLargeMcbEntry(ptr long long long long long long)
@@ -566,12 +555,10 @@
@ stdcall KdPowerTransition(long)
@ stdcall KdRefreshDebuggerNotPresent()
@ stdcall KdSystemDebugControl(long ptr long ptr long ptr long)
-#ifdef _M_IX86
-@ stdcall Ke386CallBios(long ptr)
-@ stdcall Ke386IoSetAccessProcess(ptr long)
-@ stdcall Ke386QueryIoAccessMap(long ptr)
-@ stdcall Ke386SetIoAccessMap(long ptr)
-#endif
+@ stdcall -arch=i386 Ke386CallBios(long ptr)
+@ stdcall -arch=i386 Ke386IoSetAccessProcess(ptr long)
+@ stdcall -arch=i386 Ke386QueryIoAccessMap(long ptr)
+@ stdcall -arch=i386 Ke386SetIoAccessMap(long ptr)
@ fastcall KeAcquireGuardedMutex(ptr)
@ fastcall KeAcquireGuardedMutexUnsafe(ptr)
@ fastcall KeAcquireInStackQueuedSpinLockAtDpcLevel(ptr ptr)
@@ -579,9 +566,7 @@
@ stdcall KeAcquireInterruptSpinLock(ptr)
@ stdcall KeAcquireSpinLockAtDpcLevel(ptr)
@ fastcall KeAcquireSpinLockForDpc(ptr)
-#ifdef __x86_64__
-@ stdcall KeAcquireSpinLockRaiseToDpc(ptr)
-#endif
+@ stdcall -arch=x86_64 KeAcquireSpinLockRaiseToDpc(ptr)
@ stdcall KeAddSystemServiceTable(ptr ptr long ptr long)
@ stdcall KeAreAllApcsDisabled()
@ stdcall KeAreApcsDisabled()
@@ -609,18 +594,16 @@
@ stdcall KeGetCurrentThread()
@ stdcall KeGetPreviousMode()
@ stdcall KeGetRecommendedSharedDataAlignment()
-#ifdef _M_IX86
;KeI386AbiosCall
-@ stdcall KeI386AllocateGdtSelectors(ptr long)
+@ stdcall -arch=i386 KeI386AllocateGdtSelectors(ptr long)
;KeI386Call16BitCStyleFunction
;KeI386Call16BitFunction
-@ stdcall KeI386FlatToGdtSelector(long long long)
+@ stdcall -arch=i386 KeI386FlatToGdtSelector(long long long)
;KeI386GetLid
-@ extern KeI386MachineType
-@ stdcall KeI386ReleaseGdtSelectors(ptr long)
+@ extern -arch=i386 KeI386MachineType
+@ stdcall -arch=i386 KeI386ReleaseGdtSelectors(ptr long)
;KeI386ReleaseLid
;KeI386SetGdtSelector
-#endif
@ stdcall KeInitializeApc(ptr ptr long ptr ptr ptr long ptr)
@ stdcall KeInitializeCrashDumpHeader(long long ptr long ptr)
@ stdcall KeInitializeDeviceQueue(ptr)
@@ -741,27 +724,19 @@
@ stdcall KeWaitForSingleObject(ptr long long long ptr)
@ fastcall KefAcquireSpinLockAtDpcLevel(ptr)
@ fastcall KefReleaseSpinLockFromDpcLevel(ptr)
-#ifdef _M_IX86
-@ stdcall Kei386EoiHelper()
-#endif
+@ stdcall -arch=i386 Kei386EoiHelper()
@ fastcall KiAcquireSpinLock(ptr)
@ extern KiBugCheckData
@ stdcall KiCheckForKernelApcDelivery()
;KiCheckForSListAddress
-#ifdef _M_IX86
-@ stdcall KiCoprocessorError()
-#endif
+@ stdcall -arch=i386 KiCoprocessorError()
@ stdcall KiDeliverApc(long ptr ptr)
-#ifdef _M_IX86
-@ stdcall KiDispatchInterrupt()
-#endif
+@ stdcall -arch=i386 KiDispatchInterrupt()
@ extern KiEnableTimerWatchdog
@ stdcall KiIpiServiceRoutine(ptr ptr)
@ fastcall KiReleaseSpinLock(ptr)
@ cdecl KiUnexpectedInterrupt()
-#ifdef _M_IX86
-;Kii386SpinOnSpinLock
-#endif
+;-arch=i386 Kii386SpinOnSpinLock
@ stdcall LdrAccessResource(ptr ptr ptr ptr)
@ stdcall LdrEnumResources(ptr ptr long ptr ptr)
@ stdcall LdrFindResourceDirectory_U(ptr ptr long ptr)
@@ -1568,19 +1543,17 @@
#ifndef __x86_64
@ cdecl _abnormal_termination()
#endif
-#ifdef _M_IX86
-@ cdecl _alldiv()
-@ cdecl _alldvrm()
-@ cdecl _allmul()
-@ cdecl _alloca_probe()
-@ cdecl _allrem()
-@ cdecl _allshl()
-@ cdecl _allshr()
-@ cdecl _aulldiv()
-@ cdecl _aulldvrm()
-@ cdecl _aullrem()
-@ cdecl _aullshr()
-#endif
+@ cdecl -arch=i386 _alldiv()
+@ cdecl -arch=i386 _alldvrm()
+@ cdecl -arch=i386 _allmul()
+@ cdecl -arch=i386 _alloca_probe()
+@ cdecl -arch=i386 _allrem()
+@ cdecl -arch=i386 _allshl()
+@ cdecl -arch=i386 _allshr()
+@ cdecl -arch=i386 _aulldiv()
+@ cdecl -arch=i386 _aulldvrm()
+@ cdecl -arch=i386 _aullrem()
+@ cdecl -arch=i386 _aullshr()
#ifndef __x86_64
@ cdecl _except_handler2()
@ cdecl _except_handler3()