- Remove KTSS_NOIOMP from NDK.
- Fix KTSS definition.
- Fix KTRAP_FRAME definition.
- Fix RTL_PROCESS_BACKTRACE_INFORMATION and RTL_PROCESS_BACKTRACES definitions.
- Fix/rename RUNDOWN_DESCRIPTOR definition.
- Rename PPF_ definitions to RTL_USER_PROCESS_PARAMETERS_
- Setup a global _REACTOS_ define when code is compiled.
- #ifdef out the multiboot flags from the NDK so they'll only be available for ReactOS. Dirty 'hack' until we stop using them.
- Update NDK Fixme list, since all major bugs are fixed now.
Modified: trunk/reactos/hal/halx86/mp/apic.c
Modified: trunk/reactos/include/ndk/extypes.h
Modified: trunk/reactos/include/ndk/fixmes.txt
Modified: trunk/reactos/include/ndk/haltypes.h
Modified: trunk/reactos/include/ndk/i386/ketypes.h
Modified: trunk/reactos/include/ndk/lpctypes.h
Modified: trunk/reactos/include/ndk/rtltypes.h
Modified: trunk/reactos/lib/kernel32/process/create.c
Modified: trunk/reactos/lib/rtl/ppb.c
Modified: trunk/reactos/lib/rtl/process.c
Modified: trunk/reactos/ntoskrnl/ex/init.c
Modified: trunk/reactos/ntoskrnl/ex/rundown.c
Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c
Modified: trunk/reactos/ntoskrnl/ke/apc.c
Modified: trunk/reactos/ntoskrnl/ke/clock.c
Modified: trunk/reactos/ntoskrnl/ke/usercall.c
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c
Modified: trunk/reactos/ntoskrnl/ps/debug.c

Modified: trunk/reactos/hal/halx86/mp/apic.c
--- trunk/reactos/hal/halx86/mp/apic.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/hal/halx86/mp/apic.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -772,21 +772,21 @@
 MpsIRQTrapFrameToTrapFrame(PKIRQ_TRAPFRAME IrqTrapFrame,
 			   PKTRAP_FRAME TrapFrame)
 {
-   TrapFrame->Gs     = (USHORT)IrqTrapFrame->Gs;
-   TrapFrame->Fs     = (USHORT)IrqTrapFrame->Fs;
-   TrapFrame->Es     = (USHORT)IrqTrapFrame->Es;
-   TrapFrame->Ds     = (USHORT)IrqTrapFrame->Ds;
+   TrapFrame->SegGs     = (USHORT)IrqTrapFrame->Gs;
+   TrapFrame->SegFs     = (USHORT)IrqTrapFrame->Fs;
+   TrapFrame->SegEs     = (USHORT)IrqTrapFrame->Es;
+   TrapFrame->SegDs     = (USHORT)IrqTrapFrame->Ds;
    TrapFrame->Eax    = IrqTrapFrame->Eax;
    TrapFrame->Ecx    = IrqTrapFrame->Ecx;
    TrapFrame->Edx    = IrqTrapFrame->Edx;
    TrapFrame->Ebx    = IrqTrapFrame->Ebx;
-   TrapFrame->Esp    = IrqTrapFrame->Esp;
+   TrapFrame->HardwareEsp    = IrqTrapFrame->Esp;
    TrapFrame->Ebp    = IrqTrapFrame->Ebp;
    TrapFrame->Esi    = IrqTrapFrame->Esi;
    TrapFrame->Edi    = IrqTrapFrame->Edi;
    TrapFrame->Eip    = IrqTrapFrame->Eip;
-   TrapFrame->Cs     = IrqTrapFrame->Cs;
-   TrapFrame->Eflags = IrqTrapFrame->Eflags;
+   TrapFrame->SegCs     = IrqTrapFrame->Cs;
+   TrapFrame->EFlags = IrqTrapFrame->Eflags;
 }
 
 VOID

Modified: trunk/reactos/include/ndk/extypes.h
--- trunk/reactos/include/ndk/extypes.h	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/include/ndk/extypes.h	2005-11-27 18:24:32 UTC (rev 19693)
@@ -271,13 +271,13 @@
 } EX_FAST_REF, *PEX_FAST_REF;
 
 //
-// FIXME
+// Executive Fast Reference Wait Block
 //
-typedef struct _RUNDOWN_DESCRIPTOR
+typedef struct _EX_RUNDOWN_WAIT_BLOCK
 {
-    ULONG_PTR References;
+    ULONG_PTR Count;
     KEVENT RundownEvent;
-} RUNDOWN_DESCRIPTOR, *PRUNDOWN_DESCRIPTOR;
+} EX_RUNDOWN_WAIT_BLOCK, *PEX_RUNDOWN_WAIT_BLOCK;
 
 //
 // Callback Object

Modified: trunk/reactos/include/ndk/fixmes.txt
--- trunk/reactos/include/ndk/fixmes.txt	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/include/ndk/fixmes.txt	2005-11-27 18:24:32 UTC (rev 19693)
@@ -2,23 +2,17 @@
 --------------------------------------------------------------
 ______________________________________________________________________________________
 [CRITICAL]	- Breaking compatibility with official structures.
-|pstypes.h	- EPROCESS has ReactOS only fields. Includes ReactOS Internal header.
-|pstypes.h	- W32_CALLOUT_DATA has ReactOS only fields.
-|obtypes.h	- Object callbacks are ReactOS only definitions.
-|obtypes.h	- Object Header includes ReactOS only type.
-|mmtypes.h	- _MADDRESS_SPACE is ReactOS only field.
-|ketypes.h	- _KPROFILE needs to be updated with new definitions.
-|ketypes.h	- _KINTERRUPT needs to be verified with new definitions.
-|haltypes.h	- Loader Parameter Block is ReactOS Version, not NT.
+|pstypes.h	- EPROCESS has ReactOS only fields. Includes ReactOS Internal header. IFDEF_OUT
+|pstypes.h	- W32_CALLOUT_DATA has ReactOS only fields.              IFDEF-OUT
+|obtypes.h	- Object callbacks are ReactOS only definitions.         IFDEF-OUT ADDREAL
+|obtypes.h	- Object Header includes ReactOS only type.              IFDEF-OUT
+|mmtypes.h	- _MADDRESS_SPACE is ReactOS only field.                 IFDEF-OUT
+|ketypes.h	- _KPROFILE needs to be updated with new definitions.    FIXFIX
+|ketypes.h	- _KINTERRUPT needs to be verified with new definitions. FIXFIX
+|haltypes.h	- Loader Parameter Block is ReactOS Version, not NT.     IFDEF-OUT ADDREAL
 |
 [MAJOR]		- Using incorrect, missing, or invalid names or definitions.
-|i386/ketypes.h	- _KTRAP_FRAME definition is broken.
-|i386/ketypes.h	- _KTSSNOIOPM is not an official type.
-|rtltypes.h	- PPF_ Defines don't seem to be the real names (try to find them).
-|rtltypes.h	- _RTL_PROCESS_BACKTRACE_INFORMATION isn't done.
-|haltypes.h	- Multi-Boot flags are ReactOS Only.
-|extypes.h	- _RUNDOWN_DESCRIPTOR is possibly incorrect/unofficial.
-|extypes.h	- Classes 13, 20, 30, 31, 49, 51, 52, 54+ are undefined.
+|extypes.h	- Classes 13, 20, 30, 31, 49, 51, 52, 54+ are undefined. WONTFIX
 |_____________________________________________________________________________________
 
 

Modified: trunk/reactos/include/ndk/haltypes.h
--- trunk/reactos/include/ndk/haltypes.h	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/include/ndk/haltypes.h	2005-11-27 18:24:32 UTC (rev 19693)
@@ -27,8 +27,9 @@
 #ifndef NTOS_MODE_USER
 
 //
-// Multi-Boot Flags (FIXME)
+// Multi-Boot Flags (REMOVE ME)
 //
+#ifdef _REACTOS_
 #define MB_FLAGS_MEM_INFO                   (0x1)
 #define MB_FLAGS_BOOT_DEVICE                (0x2)
 #define MB_FLAGS_COMMAND_LINE               (0x4)
@@ -42,6 +43,7 @@
 #define MB_FLAGS_APM_TABLE                  (0x400)
 #define MB_FLAGS_GRAPHICS_TABLE             (0x800)
 #define MB_FLAGS_ACPI_TABLE                 (0x1000)
+#endif
 
 //
 // HalShutdownSystem Types

Modified: trunk/reactos/include/ndk/i386/ketypes.h
--- trunk/reactos/include/ndk/i386/ketypes.h	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/include/ndk/i386/ketypes.h	2005-11-27 18:24:32 UTC (rev 19693)
@@ -90,11 +90,11 @@
 //
 typedef struct _KTRAP_FRAME
 {
-    ULONG DebugEbp;
-    ULONG DebugEip;
-    ULONG DebugArgMark;
-    ULONG DebugPointer;
-    ULONG TempCs;
+    ULONG DbgEbp;
+    ULONG DbgEip;
+    ULONG DbgArgMark;
+    ULONG DbgArgPointer;
+    ULONG TempSegCs;
     ULONG TempEsp;
     ULONG Dr0;
     ULONG Dr1;
@@ -102,29 +102,29 @@
     ULONG Dr3;
     ULONG Dr6;
     ULONG Dr7;
-    ULONG Gs;
-    ULONG Es;
-    ULONG Ds;
+    ULONG SegGs;
+    ULONG SegEs;
+    ULONG SegDs;
     ULONG Edx;
     ULONG Ecx;
     ULONG Eax;
-    ULONG PreviousMode;
-    PVOID ExceptionList;
-    ULONG Fs;
+    ULONG PreviousPreviousMode;
+    struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
+    ULONG SegFs;
     ULONG Edi;
     ULONG Esi;
     ULONG Ebx;
     ULONG Ebp;
-    ULONG ErrorCode;
+    ULONG ErrCode;
     ULONG Eip;
-    ULONG Cs;
-    ULONG Eflags;
-    ULONG Esp;
-    ULONG Ss;
-    ULONG V86_Es;
-    ULONG V86_Ds;
-    ULONG V86_Fs;
-    ULONG V86_Gs;
+    ULONG SegCs;
+    ULONG EFlags;
+    ULONG HardwareEsp;
+    ULONG HardwareSegSs;
+    ULONG V86Es;
+    ULONG V86Ds;
+    ULONG V86Fs;
+    ULONG V86Gs;
 } KTRAP_FRAME, *PKTRAP_FRAME;
 
 //
@@ -461,99 +461,45 @@
 #pragma pack(pop)
 
 //
-// FIXME: TSS without I/O Privilege Map
+// TSS Definition
 //
-#include <pshpack1.h>
-typedef struct _KTSSNOIOPM
+typedef struct _KiIoAccessMap
 {
-    USHORT PreviousTask;
-    USHORT Reserved1;
-    ULONG  Esp0;
-    USHORT Ss0;
-    USHORT Reserved2;
-    ULONG  Esp1;
-    USHORT Ss1;
-    USHORT Reserved3;
-    ULONG  Esp2;
-    USHORT Ss2;
-    USHORT Reserved4;
-    ULONG  Cr3;
-    ULONG  Eip;
-    ULONG  Eflags;
-    ULONG  Eax;
-    ULONG  Ecx;
-    ULONG  Edx;
-    ULONG  Ebx;
-    ULONG  Esp;
-    ULONG  Ebp;
-    ULONG  Esi;
-    ULONG  Edi;
-    USHORT Es;
-    USHORT Reserved5;
-    USHORT Cs;
-    USHORT Reserved6;
-    USHORT Ss;
-    USHORT Reserved7;
-    USHORT Ds;
-    USHORT Reserved8;
-    USHORT Fs;
-    USHORT Reserved9;
-    USHORT Gs;
-    USHORT Reserved10;
-    USHORT Ldt;
-    USHORT Reserved11;
-    USHORT Trap;
-    USHORT IoMapBase;
-    /* no interrupt redirection map */
-    UCHAR IoBitmap[1];
-} KTSSNOIOPM;
+    UCHAR DirectionMap[32];
+    UCHAR IoMap[8196];
+} KIIO_ACCESS_MAP;
 
-//
-// TSS Definition
-//
+#include <pshpack1.h>
 typedef struct _KTSS
 {
-    USHORT PreviousTask;
-    USHORT Reserved1;
+    USHORT Backlink;
+    USHORT Reserved0;
     ULONG Esp0;
     USHORT Ss0;
-    USHORT Reserved2;
-    ULONG Esp1;
-    USHORT Ss1;
-    USHORT Reserved3;
-    ULONG Esp2;
-    USHORT Ss2;
-    USHORT Reserved4;
-    ULONG Cr3;
+    USHORT Reserved1;
+    ULONG NotUsed1[4];
+    ULONG CR3;
     ULONG Eip;
-    ULONG Eflags;
-    ULONG Eax;
-    ULONG Ecx;
-    ULONG Edx;
-    ULONG Ebx;
-    ULONG Esp;
-    ULONG Ebp;
-    ULONG Esi;
-    ULONG Edi;
+    ULONG NotUsed2[9];
     USHORT Es;
-    USHORT Reserved5;
+    USHORT Reserved2;
     USHORT Cs;
-    USHORT Reserved6;
+    USHORT Reserved3;
     USHORT Ss;
-    USHORT Reserved7;
+    USHORT Reserved4;
     USHORT Ds;
-    USHORT Reserved8;
+    USHORT Reserved5;
     USHORT Fs;
-    USHORT Reserved9;
+    USHORT Reserved6;
     USHORT Gs;
-    USHORT Reserved10;
-    USHORT Ldt;
-    USHORT Reserved11;
-    USHORT Trap;
+    USHORT Reserved7;
+    USHORT LDT;
+    USHORT Reserved8;
+    USHORT Flags;
     USHORT IoMapBase;
-    /* no interrupt redirection map */
-    UCHAR IoBitmap[8193];
-} KTSS;
+    KIIO_ACCESS_MAP IoMaps[1];
+    UCHAR IntDirectionMap[32];
+} KTSS, *PKTSS;
 #include <poppack.h>
 
 //

Modified: trunk/reactos/include/ndk/lpctypes.h
--- trunk/reactos/include/ndk/lpctypes.h	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/include/ndk/lpctypes.h	2005-11-27 18:24:32 UTC (rev 19693)
@@ -26,6 +26,12 @@
 #include <pstypes.h>
 
 //
+// Internal helper macro
+//
+#define N_ROUND_UP(x,s) \
+    (((ULONG)(x)+(s)-1) & ~((ULONG)(s)-1))
+
+//
 // Maximum message size that can be sent through an LPC Port without a section
 //
 #define PORT_MAXIMUM_MESSAGE_LENGTH     256
@@ -234,9 +240,9 @@
 // Maximum total Kernel-Mode LPC Message Structure Size
 //
 #define LPCP_MAX_MESSAGE_SIZE \
-    ALIGN_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
+    N_ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
     sizeof(LPCP_MESSAGE) + \
-    sizeof(LPCP_CONNECTION_MESSAGE), sizeof(ULONGLONG) * 2)
+    sizeof(LPCP_CONNECTION_MESSAGE), 16)
 
 //
 // Maximum actual LPC Message Length

Modified: trunk/reactos/include/ndk/rtltypes.h
--- trunk/reactos/include/ndk/rtltypes.h	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/include/ndk/rtltypes.h	2005-11-27 18:24:32 UTC (rev 19693)
@@ -31,17 +31,17 @@
 #define RTL_MAXIMUM_ATOM_LENGTH                              255
 
 //
-// Process Parameters Flags (FIXME: Rename)
+// Process Parameters Flags
 //
-#define PPF_NORMALIZED                                       0x01
-#define PPF_PROFILE_USER                                     0x02
-#define PPF_PROFILE_SERVER                                   0x04
-#define PPF_PROFILE_KERNEL                                   0x08
-#define PPF_UNKNOWN                                          0x10
-#define PPF_RESERVE_1MB                                      0x20
-#define PPF_DISABLE_HEAP_CHECKS                              0x100
-#define PPF_PROCESS_OR_1                                     0x200
-#define PPF_PROCESS_OR_2                                     0x400
+#define RTL_USER_PROCESS_PARAMETERS_NORMALIZED               0x01
+#define RTL_USER_PROCESS_PARAMETERS_PROFILE_USER             0x02
+#define RTL_USER_PROCESS_PARAMETERS_PROFILE_SERVER           0x04
+#define RTL_USER_PROCESS_PARAMETERS_PROFILE_KERNEL           0x08
+#define RTL_USER_PROCESS_PARAMETERS_UNKNOWN                  0x10
+#define RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB              0x20
+#define RTL_USER_PROCESS_PARAMETERS_DISABLE_HEAP_CHECKS      0x100
+#define RTL_USER_PROCESS_PARAMETERS_PROCESS_OR_1             0x200
+#define RTL_USER_PROCESS_PARAMETERS_PROCESS_OR_2             0x400
 
 //
 // Exception Flags
@@ -613,14 +613,20 @@
 
 typedef struct _RTL_PROCESS_BACKTRACE_INFORMATION
 {
-    /* FIXME */
-    ULONG Unknown;
+    PVOID SymbolicBackTrace;
+    ULONG TraceCount;
+    USHORT Index;
+    USHORT Depth;
+    PVOID BackTrace[16];
 } RTL_PROCESS_BACKTRACE_INFORMATION, *PRTL_PROCESS_BACKTRACE_INFORMATION;
 
 typedef struct _RTL_PROCESS_BACKTRACES
 {
-    ULONG BackTraceCount;
-    RTL_PROCESS_BACKTRACE_INFORMATION BackTraceEntry[1];
+    ULONG CommittedMemory;
+    ULONG ReservedMemory;
+    ULONG NumberOfBackTraceLookups;
+    ULONG NumberOfBackTraces;
+    RTL_PROCESS_BACKTRACE_INFORMATION BackTraces[1];
 } RTL_PROCESS_BACKTRACES, *PRTL_PROCESS_BACKTRACES;
 
 typedef struct _RTL_DEBUG_BUFFER

Modified: trunk/reactos/lib/kernel32/process/create.c
--- trunk/reactos/lib/kernel32/process/create.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/lib/kernel32/process/create.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -580,13 +580,13 @@
     /* Handle some Parameter Flags */
     ProcessParameters->ConsoleFlags = (CreationFlags & CREATE_NEW_PROCESS_GROUP);
     ProcessParameters->Flags |= (CreationFlags & PROFILE_USER) ?
-                                 PPF_PROFILE_USER : 0;
+                                 RTL_USER_PROCESS_PARAMETERS_PROFILE_USER : 0;
     ProcessParameters->Flags |= (CreationFlags & PROFILE_KERNEL) ? 
-                                 PPF_PROFILE_KERNEL : 0;    
+                                 RTL_USER_PROCESS_PARAMETERS_PROFILE_KERNEL : 0;    
     ProcessParameters->Flags |= (CreationFlags & PROFILE_SERVER) ?
-                                 PPF_PROFILE_SERVER : 0;
+                                 RTL_USER_PROCESS_PARAMETERS_PROFILE_SERVER : 0;
     ProcessParameters->Flags |= (NtCurrentPeb()->ProcessParameters->Flags &
-                                 PPF_DISABLE_HEAP_CHECKS);
+                                 RTL_USER_PROCESS_PARAMETERS_DISABLE_HEAP_CHECKS);
     
     /* Write the Parameter Block */
     Status = NtWriteVirtualMemory(ProcessHandle,

Modified: trunk/reactos/lib/rtl/ppb.c
--- trunk/reactos/lib/rtl/ppb.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/lib/rtl/ppb.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -139,7 +139,7 @@
 
    Param->MaximumLength = RegionSize;
    Param->Length = Length;
-   Param->Flags = PPF_NORMALIZED;
+   Param->Flags = RTL_USER_PROCESS_PARAMETERS_NORMALIZED;
    Param->Environment = Environment;
    Param->CurrentDirectory.Handle = CurrentDirectoryHandle;
    Param->ConsoleHandle = ConsoleHandle;
@@ -238,7 +238,7 @@
 PRTL_USER_PROCESS_PARAMETERS NTAPI
 RtlDeNormalizeProcessParams(PRTL_USER_PROCESS_PARAMETERS Params)
 {
-   if (Params && (Params->Flags & PPF_NORMALIZED))
+   if (Params && (Params->Flags & RTL_USER_PROCESS_PARAMETERS_NORMALIZED))
      {
 	DENORMALIZE(Params->CurrentDirectory.DosPath.Buffer, Params);
 	DENORMALIZE(Params->DllPath.Buffer, Params);
@@ -249,7 +249,7 @@
 	DENORMALIZE(Params->ShellInfo.Buffer, Params);
 	DENORMALIZE(Params->RuntimeData.Buffer, Params);
 
-	Params->Flags &= ~PPF_NORMALIZED;
+	Params->Flags &= ~RTL_USER_PROCESS_PARAMETERS_NORMALIZED;
      }
 
    return Params;
@@ -263,7 +263,7 @@
 PRTL_USER_PROCESS_PARAMETERS NTAPI
 RtlNormalizeProcessParams(PRTL_USER_PROCESS_PARAMETERS Params)
 {
-   if (Params && !(Params->Flags & PPF_NORMALIZED))
+   if (Params && !(Params->Flags & RTL_USER_PROCESS_PARAMETERS_NORMALIZED))
      {
 	NORMALIZE(Params->CurrentDirectory.DosPath.Buffer, Params);
 	NORMALIZE(Params->DllPath.Buffer, Params);
@@ -274,7 +274,7 @@
 	NORMALIZE(Params->ShellInfo.Buffer, Params);
 	NORMALIZE(Params->RuntimeData.Buffer, Params);
 
-	Params->Flags |= PPF_NORMALIZED;
+	Params->Flags |= RTL_USER_PROCESS_PARAMETERS_NORMALIZED;
      }
 
    return Params;

Modified: trunk/reactos/lib/rtl/process.c
--- trunk/reactos/lib/rtl/process.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/lib/rtl/process.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -80,7 +80,7 @@
             ProcessHandle, Peb, ProcessParameters);
             
     /* Give the caller 1MB if he requested it */
-    if (ProcessParameters->Flags & PPF_RESERVE_1MB)
+    if (ProcessParameters->Flags & RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB)
     {
         /* Give 1MB starting at 0x4 */
         BaseAddress = (PVOID)4;

Modified: trunk/reactos/ntoskrnl/ex/init.c
--- trunk/reactos/ntoskrnl/ex/init.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/ntoskrnl/ex/init.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -250,7 +250,6 @@
     ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, CurrentThread) == KPCR_CURRENT_THREAD);
     ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, NpxThread) == KPCR_NPX_THREAD);
     ASSERT(FIELD_OFFSET(KTSS, Esp0) == KTSS_ESP0);
-    ASSERT(FIELD_OFFSET(KTSS, Eflags) == KTSS_EFLAGS);
     ASSERT(FIELD_OFFSET(KTSS, IoMapBase) == KTSS_IOMAPBASE);
     ASSERT(sizeof(FX_SAVE_AREA) == SIZEOF_FX_SAVE_AREA);
 }

Modified: trunk/reactos/ntoskrnl/ex/rundown.c
--- trunk/reactos/ntoskrnl/ex/rundown.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/ntoskrnl/ex/rundown.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -123,7 +123,7 @@
         if (Current & EX_RUNDOWN_ACTIVE)
         {
             /* Get Pointer */
-            PRUNDOWN_DESCRIPTOR RundownDescriptor = (PRUNDOWN_DESCRIPTOR)(Current & ~EX_RUNDOWN_ACTIVE);
+            PEX_RUNDOWN_WAIT_BLOCK RundownDescriptor = (PEX_RUNDOWN_WAIT_BLOCK)(Current & ~EX_RUNDOWN_ACTIVE);
 
             if (RundownDescriptor == NULL)
             {
@@ -131,9 +131,9 @@
                 break;
             }
 
-            Current = RundownDescriptor->References;
+            Current = RundownDescriptor->Count;
 
-            /* Decrease RundownDescriptor->References by Count references */
+            /* Decrease RundownDescriptor->Count by Count Count */
             for (;;)
             {
                 ULONG_PTR PrevCount, NewCount;
@@ -144,12 +144,12 @@
                 }
                 else
                 {
-                    NewCount = ((RundownDescriptor->References - (Count >> EX_RUNDOWN_COUNT_SHIFT)) << EX_RUNDOWN_COUNT_SHIFT) | EX_RUNDOWN_ACTIVE;
+                    NewCount = ((RundownDescriptor->Count - (Count >> EX_RUNDOWN_COUNT_SHIFT)) << EX_RUNDOWN_COUNT_SHIFT) | EX_RUNDOWN_ACTIVE;
                 }
 #ifdef _WIN64
-                PrevCount = (ULONG_PTR)InterlockedCompareExchange64((LONGLONG*)&RundownDescriptor->References, (LONGLONG)NewCount, (LONGLONG)Current);
+                PrevCount = (ULONG_PTR)InterlockedCompareExchange64((LONGLONG*)&RundownDescriptor->Count, (LONGLONG)NewCount, (LONGLONG)Current);
 #else
-                PrevCount = (ULONG_PTR)InterlockedCompareExchange((LONG*)&RundownDescriptor->References, (LONG)NewCount, (LONG)Current);
+                PrevCount = (ULONG_PTR)InterlockedCompareExchange((LONG*)&RundownDescriptor->Count, (LONG)NewCount, (LONG)Current);
 #endif
                 if (PrevCount == Current)
                 {
@@ -227,7 +227,7 @@
     )
 {
     ULONG_PTR PrevCount, NewPtr, PrevPtr;
-    RUNDOWN_DESCRIPTOR RundownDescriptor;
+    EX_RUNDOWN_WAIT_BLOCK RundownDescriptor;
 
     PAGED_CODE();
 
@@ -236,9 +236,9 @@
     if (PrevCount != 0 && !(PrevCount & EX_RUNDOWN_ACTIVE))
     {
         /* save the reference counter */
-        RundownDescriptor.References = PrevCount >> EX_RUNDOWN_COUNT_SHIFT;
+        RundownDescriptor.Count = PrevCount >> EX_RUNDOWN_COUNT_SHIFT;
 
-        /* Pending references... wait on them to be closed with an event */
+        /* Pending Count... wait on them to be closed with an event */
         KeInitializeEvent(&RundownDescriptor.RundownEvent, NotificationEvent, FALSE);
 
         ASSERT(!((ULONG_PTR)&RundownDescriptor & EX_RUNDOWN_ACTIVE));
@@ -267,7 +267,7 @@
             PrevCount = PrevPtr;
 
             /* save the changed reference counter and try again */
-            RundownDescriptor.References = PrevCount >> EX_RUNDOWN_COUNT_SHIFT;
+            RundownDescriptor.Count = PrevCount >> EX_RUNDOWN_COUNT_SHIFT;
         }
     }
 }

Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c
--- trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -133,18 +133,18 @@
   { 4, FIELD_OFFSET(KTRAP_FRAME, Ecx), FIELD_OFFSET(CONTEXT, Ecx), TRUE },
   { 4, FIELD_OFFSET(KTRAP_FRAME, Edx), FIELD_OFFSET(CONTEXT, Edx), FALSE },
   { 4, FIELD_OFFSET(KTRAP_FRAME, Ebx), FIELD_OFFSET(CONTEXT, Ebx), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, Esp), FIELD_OFFSET(CONTEXT, Esp), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, DebugEbp), FIELD_OFFSET(CONTEXT, Ebp), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, HardwareEsp ), FIELD_OFFSET(CONTEXT, Esp), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, DbgEbp), FIELD_OFFSET(CONTEXT, Ebp), TRUE },
   { 4, FIELD_OFFSET(KTRAP_FRAME, Esi), FIELD_OFFSET(CONTEXT, Esi), TRUE },
   { 4, FIELD_OFFSET(KTRAP_FRAME, Edi), FIELD_OFFSET(CONTEXT, Edi), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, DebugEip), FIELD_OFFSET(CONTEXT, Eip), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, Eflags), FIELD_OFFSET(CONTEXT, EFlags), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, Cs), FIELD_OFFSET(CONTEXT, SegCs), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, Ss), FIELD_OFFSET(CONTEXT, SegSs), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, Ds), FIELD_OFFSET(CONTEXT, SegDs), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, Es), FIELD_OFFSET(CONTEXT, SegEs), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, Fs), FIELD_OFFSET(CONTEXT, SegFs), TRUE },
-  { 4, FIELD_OFFSET(KTRAP_FRAME, Gs), FIELD_OFFSET(CONTEXT, SegGs), TRUE }
+  { 4, FIELD_OFFSET(KTRAP_FRAME, DbgEip), FIELD_OFFSET(CONTEXT, Eip), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, EFlags), FIELD_OFFSET(CONTEXT, EFlags), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, SegCs), FIELD_OFFSET(CONTEXT, SegCs), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, HardwareSegSs), FIELD_OFFSET(CONTEXT, SegSs), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, SegDs), FIELD_OFFSET(CONTEXT, SegDs), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, SegEs), FIELD_OFFSET(CONTEXT, SegEs), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, SegFs), FIELD_OFFSET(CONTEXT, SegFs), TRUE },
+  { 4, FIELD_OFFSET(KTRAP_FRAME, SegGs), FIELD_OFFSET(CONTEXT, SegGs), TRUE }
 };
 
 static PCHAR GspThreadStates[DeferredReady+1] =
@@ -564,7 +564,7 @@
 GspGetEspFromTrapFrame(PKTRAP_FRAME TrapFrame)
 {
   return KeGetPreviousMode() == KernelMode
-         ? (LONG) &TrapFrame->Esp : (LONG)TrapFrame->Esp;
+         ? (LONG) &TrapFrame->HardwareEsp : (LONG)TrapFrame->HardwareEsp;
 }
 
 

Modified: trunk/reactos/ntoskrnl/ke/apc.c
--- trunk/reactos/ntoskrnl/ke/apc.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/ntoskrnl/ke/apc.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -906,7 +906,7 @@
             KeGetCurrentThread()->TrapFrame);
 
     /* Don't deliver APCs in V86 mode */
-    if (TrapFrame->Eflags & X86_EFLAGS_VM) return;
+    if (TrapFrame->EFlags & X86_EFLAGS_VM) return;
 
     /* Save the full context */
     Context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
@@ -927,7 +927,7 @@
 
         /* Run at APC dispatcher */
         TrapFrame->Eip = (ULONG)KeUserApcDispatcher;
-        TrapFrame->Esp = Stack;
+        TrapFrame->HardwareEsp = Stack;
 
         /* Setup the stack */
         *(PULONG_PTR)(Stack + 0 * sizeof(ULONG_PTR)) = (ULONG_PTR)NormalRoutine;

Modified: trunk/reactos/ntoskrnl/ke/clock.c
--- trunk/reactos/ntoskrnl/ke/clock.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/ntoskrnl/ke/clock.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -260,8 +260,8 @@
     * Cs bit 0 is always set for user mode if we are in protected mode.
     * V86 mode is counted as user time.
     */
-   if (TrapFrame->Cs & 0x1 ||
-       TrapFrame->Eflags & X86_EFLAGS_VM)
+   if (TrapFrame->SegCs & MODE_MASK ||
+       TrapFrame->EFlags & X86_EFLAGS_VM)
    {
       InterlockedIncrementUL(&CurrentThread->UserTime);
       InterlockedIncrementUL(&CurrentProcess->UserTime);

Modified: trunk/reactos/ntoskrnl/ke/usercall.c
--- trunk/reactos/ntoskrnl/ke/usercall.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/ntoskrnl/ke/usercall.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -207,9 +207,9 @@
                 Thread->Tcb.TrapFrame, sizeof(KTRAP_FRAME) - (4 * sizeof(ULONG)));
   NewFrame = (PKTRAP_FRAME)((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA));
   /* We need the stack pointer to remain 4-byte aligned */
-  NewFrame->Esp -= (((ArgumentLength + 3) & (~ 0x3)) + (4 * sizeof(ULONG)));
+  NewFrame->HardwareEsp -= (((ArgumentLength + 3) & (~ 0x3)) + (4 * sizeof(ULONG)));
   NewFrame->Eip = (ULONG)KeUserCallbackDispatcher;
-  UserEsp = (PULONG)NewFrame->Esp;
+  UserEsp = (PULONG)NewFrame->HardwareEsp;
   UserEsp[0] = 0;     /* Return address. */
   UserEsp[1] = RoutineIndex;
   UserEsp[2] = (ULONG)&UserEsp[4];

Modified: trunk/reactos/ntoskrnl/mm/pagefile.c
--- trunk/reactos/ntoskrnl/mm/pagefile.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/ntoskrnl/mm/pagefile.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -544,7 +544,7 @@
    Headers->Type = MmCoreDumpType;
    if (TrapFrame != NULL)
    {
-      if (!(TrapFrame->Eflags & (1 << 17)))
+      if (!(TrapFrame->EFlags & (1 << 17)))
       {
          memcpy(&Headers->TrapFrame, TrapFrame,
                 sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD)));

Modified: trunk/reactos/ntoskrnl/ps/debug.c
--- trunk/reactos/ntoskrnl/ps/debug.c	2005-11-27 17:05:37 UTC (rev 19692)
+++ trunk/reactos/ntoskrnl/ps/debug.c	2005-11-27 18:24:32 UTC (rev 19693)
@@ -56,7 +56,7 @@
     Event = &GetSetContext->Event;
     Mode = GetSetContext->Mode;
 
-    if (TrapFrame->Cs == KGDT_R0_CODE && Mode != KernelMode)
+    if (TrapFrame->SegCs == KGDT_R0_CODE && Mode != KernelMode)
     {
         GetSetContext->Status = STATUS_ACCESS_DENIED;
     }