Author: tkreuzer
Date: Wed Mar 24 22:56:24 2010
New Revision: 46405
URL:
http://svn.reactos.org/svn/reactos?rev=46405&view=rev
Log:
[RTL]
Fix RtlInitializeSListHead and RtlQueryDepthSList
Modified:
branches/ros-amd64-bringup/reactos/lib/rtl/slist.c
Modified: branches/ros-amd64-bringup/reactos/lib/rtl/slist.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/r…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/rtl/slist.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/rtl/slist.c [iso-8859-1] Wed Mar 24 22:56:24
2010
@@ -17,15 +17,32 @@
VOID
NTAPI
-RtlInitializeSListHead(IN PSLIST_HEADER ListHead)
+RtlInitializeSListHead(
+ OUT PSLIST_HEADER SListHead)
{
-#ifdef _WIN64
- ListHead->Alignment = 0;
- ListHead->Region = 0;
- ListHead->Header8.Init = 1;
- // ListHead->Header8.HeaderType = 1; // FIXME: depending on cmpxchg16b support?
-#else
- ListHead->Alignment = 0;
+#if defined(_IA64_)
+ ULONG64 FeatureBits;
+#endif
+
+#if defined(_WIN64)
+ /* Make sure the alignment is ok */
+ if (((ULONG_PTR)SListHead & 0xf) != 0)
+ {
+ RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT);
+ }
+#endif
+
+ /* Zero it */
+ SListHead->Alignment = 0;
+ SListHead->Region = 0;
+
+#if defined(_IA64_)
+ FeatureBits = __getReg(CV_IA64_CPUID4);
+ if (FeatureBits & KF_16BYTE_INSTR)
+ {
+ SListHead->Header16.HeaderType = 1;
+ SListHead->Header16.Init = 1;
+ }
#endif
}
@@ -64,7 +81,7 @@
{
#ifdef _WIN64
return ListHead->Header8.HeaderType ?
- ListHead->Header16.Sequence : ListHead->Header8.Sequence;
+ ListHead->Header16.Depth : ListHead->Header8.Depth;
#else
return ListHead->Depth;
#endif