Author: rharabien
Date: Fri Oct 7 16:18:52 2011
New Revision: 54048
URL:
http://svn.reactos.org/svn/reactos?rev=54048&view=rev
Log:
[NTOSKRNL]
- Rename KTHREAD.DispatchHeader to Header
- Remove KeInitializeDispatcherHeader and initialize dispatcher headers depending on
object type. Fixes all ntos:KeEvent and KeTimer kmtests.
Modified:
trunk/reactos/include/asm/ks386.template.h
trunk/reactos/include/asm/ksx.template.h
trunk/reactos/include/ndk/ketypes.h
trunk/reactos/ntoskrnl/include/internal/i386/trap_x.h
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/ke/eventobj.c
trunk/reactos/ntoskrnl/ke/gate.c
trunk/reactos/ntoskrnl/ke/i386/cpu.c
trunk/reactos/ntoskrnl/ke/i386/exp.c
trunk/reactos/ntoskrnl/ke/i386/thrdini.c
trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
trunk/reactos/ntoskrnl/ke/mutex.c
trunk/reactos/ntoskrnl/ke/procobj.c
trunk/reactos/ntoskrnl/ke/queue.c
trunk/reactos/ntoskrnl/ke/semphobj.c
trunk/reactos/ntoskrnl/ke/thrdobj.c
trunk/reactos/ntoskrnl/ke/timerobj.c
trunk/reactos/ntoskrnl/ps/process.c
trunk/reactos/ntoskrnl/ps/thread.c
Modified: trunk/reactos/include/asm/ks386.template.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/asm/ks386.template…
==============================================================================
--- trunk/reactos/include/asm/ks386.template.h [iso-8859-1] (original)
+++ trunk/reactos/include/asm/ks386.template.h [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -391,7 +391,7 @@
//#define EXCEPTION_RECORD_LENGTH 0x50
HEADER("KTHREAD"),
-OFFSET(KTHREAD_DEBUG_ACTIVE, KTHREAD, DispatcherHeader.DebugActive),
+OFFSET(KTHREAD_DEBUG_ACTIVE, KTHREAD, Header.DebugActive),
OFFSET(KTHREAD_INITIAL_STACK, KTHREAD, InitialStack),
OFFSET(KTHREAD_STACK_LIMIT, KTHREAD, StackLimit),
OFFSET(KTHREAD_TEB, KTHREAD, Teb),
Modified: trunk/reactos/include/asm/ksx.template.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/asm/ksx.template.h…
==============================================================================
--- trunk/reactos/include/asm/ksx.template.h [iso-8859-1] (original)
+++ trunk/reactos/include/asm/ksx.template.h [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -592,13 +592,13 @@
OFFSET(TfMilliseconds, TIME_FIELDS, Milliseconds),
HEADER("KTHREAD"),
-OFFSET(ThType, KTHREAD, DispatcherHeader.Type),
+OFFSET(ThType, KTHREAD, Header.Type),
//OFFSET(ThNpxIrql, KTHREAD, NpxIrql),
-OFFSET(ThSize, KTHREAD, DispatcherHeader.Size),
-OFFSET(ThLock, KTHREAD, DispatcherHeader.Lock),
-OFFSET(ThDebugActive, KTHREAD, DispatcherHeader.DebugActive),
+OFFSET(ThSize, KTHREAD, Header.Size),
+OFFSET(ThLock, KTHREAD, Header.Lock),
+OFFSET(ThDebugActive, KTHREAD, Header.DebugActive),
//OFFSET(ThThreadControlFlags, KTHREAD, DispatcherHeader.ThreadControlFlags),
-OFFSET(ThSignalState, KTHREAD, DispatcherHeader.SignalState),
+OFFSET(ThSignalState, KTHREAD, Header.SignalState),
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
OFFSET(ThCycleTime, KTHREAD, CycleTime),
OFFSET(ThHighCycleTime, KTHREAD, HighCycleTime),
Modified: trunk/reactos/include/ndk/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ketypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/ketypes.h [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -681,7 +681,7 @@
//
typedef struct _KTHREAD
{
- DISPATCHER_HEADER DispatcherHeader;
+ DISPATCHER_HEADER Header;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
ULONGLONG CycleTime;
ULONG HighCycleTime;
@@ -929,7 +929,7 @@
} KTHREAD;
#define ASSERT_THREAD(object) \
- ASSERT((((object)->DispatcherHeader.Type & KOBJECT_TYPE_MASK) ==
ThreadObject))
+ ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == ThreadObject))
//
// Kernel Process (KPROCESS)
Modified: trunk/reactos/ntoskrnl/include/internal/i386/trap_x.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/trap_x.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/trap_x.h [iso-8859-1] Fri Oct 7 16:18:52
2011
@@ -288,7 +288,7 @@
/* Flush DR7 and check for debugging */
TrapFrame->Dr7 = 0;
- if (__builtin_expect(KeGetCurrentThread()->DispatcherHeader.DebugActive &
0xFF, 0))
+ if (__builtin_expect(KeGetCurrentThread()->Header.DebugActive & 0xFF, 0))
{
DbgPrint("Need Hardware Breakpoint Support!\n");
while (TRUE);
@@ -310,7 +310,7 @@
/* Flush DR7 and check for debugging */
TrapFrame->Dr7 = 0;
- if (__builtin_expect(KeGetCurrentThread()->DispatcherHeader.DebugActive &
0xFF, 0))
+ if (__builtin_expect(KeGetCurrentThread()->Header.DebugActive & 0xFF, 0))
{
DbgPrint("Need Hardware Breakpoint Support!\n");
while (TRUE);
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] Fri Oct 7 16:18:52 2011
@@ -146,17 +146,6 @@
#define AFFINITY_MASK(Id) KiMask32Array[Id]
#define PRIORITY_MASK(Id) KiMask32Array[Id]
-/* The following macro initializes a dispatcher object's header */
-#define KeInitializeDispatcherHeader(Header, t, s, State) \
-{ \
- (Header)->Type = t; \
- (Header)->Absolute = 0; \
- (Header)->Size = s; \
- (Header)->Inserted = 0; \
- (Header)->SignalState = State; \
- InitializeListHead(&((Header)->WaitListHead)); \
-}
-
/* Tells us if the Timer or Event is a Syncronization or Notification Object */
#define TIMER_OR_EVENT_TYPE 0x7L
Modified: trunk/reactos/ntoskrnl/ke/eventobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/eventobj.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/eventobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/eventobj.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -37,10 +37,11 @@
IN BOOLEAN State)
{
/* Initialize the Dispatcher Header */
- KeInitializeDispatcherHeader(&Event->Header,
- Type,
- sizeof(*Event) / sizeof(ULONG),
- State);
+ Event->Header.Type = Type;
+ //Event->Header.Signalling = FALSE; // fails in kmtest
+ Event->Header.Size = sizeof(KEVENT) / sizeof(ULONG);
+ Event->Header.SignalState = State;
+ InitializeListHead(&(Event->Header.WaitListHead));
}
/*
Modified: trunk/reactos/ntoskrnl/ke/gate.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/gate.c?rev=540…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/gate.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/gate.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -19,10 +19,11 @@
KeInitializeGate(IN PKGATE Gate)
{
/* Initialize the Dispatcher Header */
- KeInitializeDispatcherHeader(&Gate->Header,
- GateObject,
- sizeof(KGATE) / sizeof(ULONG),
- 0);
+ Gate->Header.Type = GateObject;
+ Gate->Header.Signalling = FALSE;
+ Gate->Header.Size = sizeof(KGATE) / sizeof(ULONG);
+ Gate->Header.SignalState = 0;
+ InitializeListHead(&(Gate->Header.WaitListHead));
}
VOID
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] Fri Oct 7 16:18:52 2011
@@ -1431,7 +1431,7 @@
};
#endif
- KeGetCurrentThread()->DispatcherHeader.NpxIrql = KeGetCurrentIrql();
+ KeGetCurrentThread()->Header.NpxIrql = KeGetCurrentIrql();
return STATUS_SUCCESS;
}
@@ -1443,7 +1443,7 @@
KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
{
PFNSAVE_FORMAT FpState = *((PVOID *) Save);
- ASSERT(KeGetCurrentThread()->DispatcherHeader.NpxIrql == KeGetCurrentIrql());
+ ASSERT(KeGetCurrentThread()->Header.NpxIrql == KeGetCurrentIrql());
DPRINT1("%s is not really implemented\n", __FUNCTION__);
#ifdef __GNUC__
Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/exp.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/exp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/exp.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -70,7 +70,7 @@
FASTCALL
KiUpdateDr7(IN ULONG Dr7)
{
- ULONG DebugMask = KeGetCurrentThread()->DispatcherHeader.DebugActive;
+ ULONG DebugMask = KeGetCurrentThread()->Header.DebugActive;
/* Check if debugging is enabled */
if (DebugMask & DR_MASK(DR7_OVERRIDE_V))
@@ -97,7 +97,7 @@
if (!DrMask)
{
/* He didn't, use the one from the thread */
- Mask = KeGetCurrentThread()->DispatcherHeader.DebugActive;
+ Mask = KeGetCurrentThread()->Header.DebugActive;
}
else
{
@@ -153,7 +153,7 @@
if (Mask != NewMask)
{
/* Update it */
- KeGetCurrentThread()->DispatcherHeader.DebugActive =
+ KeGetCurrentThread()->Header.DebugActive =
(BOOLEAN)NewMask;
}
}
@@ -611,7 +611,7 @@
if (PreviousMode != KernelMode)
{
/* Save the mask */
- KeGetCurrentThread()->DispatcherHeader.DebugActive = (DrMask != 0);
+ KeGetCurrentThread()->Header.DebugActive = (DrMask != 0);
}
}
Modified: trunk/reactos/ntoskrnl/ke/i386/thrdini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/thrdini.c…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -163,7 +163,7 @@
/* Set the Thread's NPX State */
Thread->NpxState = NPX_STATE_NOT_LOADED;
- Thread->DispatcherHeader.NpxIrql = PASSIVE_LEVEL;
+ Thread->Header.NpxIrql = PASSIVE_LEVEL;
}
else
{
Modified: trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/traphdlr.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -1523,7 +1523,7 @@
/* Clear DR7 and check for debugging */
TrapFrame->Dr7 = 0;
- if (__builtin_expect(Thread->DispatcherHeader.DebugActive & 0xFF, 0))
+ if (__builtin_expect(Thread->Header.DebugActive & 0xFF, 0))
{
UNIMPLEMENTED;
while (TRUE);
Modified: trunk/reactos/ntoskrnl/ke/mutex.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/mutex.c?rev=54…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/mutex.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/mutex.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -49,10 +49,11 @@
}
/* Now we set up the Dispatcher Header */
- KeInitializeDispatcherHeader(&Mutant->Header,
- MutantObject,
- sizeof(KMUTANT) / sizeof(ULONG),
- InitialOwner ? FALSE : TRUE);
+ Mutant->Header.Type = MutantObject;
+ Mutant->Header.Size = sizeof(KMUTANT) / sizeof(ULONG);
+ Mutant->Header.DpcActive = FALSE;
+ Mutant->Header.SignalState = InitialOwner ? 0 : 1;
+ InitializeListHead(&(Mutant->Header.WaitListHead));
/* Initialize the default data */
Mutant->Abandoned = FALSE;
@@ -68,10 +69,11 @@
IN ULONG Level)
{
/* Set up the Dispatcher Header */
- KeInitializeDispatcherHeader(&Mutex->Header,
- MutantObject,
- sizeof(KMUTEX) / sizeof(ULONG),
- TRUE);
+ Mutex->Header.Type = MutantObject;
+ Mutex->Header.Size = sizeof(KMUTEX) / sizeof(ULONG);
+ Mutex->Header.DpcActive = FALSE;
+ Mutex->Header.SignalState = 1;
+ InitializeListHead(&(Mutex->Header.WaitListHead));
/* Initialize the default data */
Mutex->OwnerThread = NULL;
Modified: trunk/reactos/ntoskrnl/ke/procobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/procobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/procobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/procobj.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -125,10 +125,10 @@
#endif
/* Initialize the Dispatcher Header */
- KeInitializeDispatcherHeader(&Process->Header,
- ProcessObject,
- sizeof(KPROCESS),
- FALSE);
+ Process->Header.Type = ProcessObject;
+ Process->Header.Size = sizeof(KPROCESS) / sizeof(ULONG);
+ Process->Header.SignalState = 0;
+ InitializeListHead(&(Process->Header.WaitListHead));
/* Initialize Scheduler Data, Alignment Faults and Set the PDE */
Process->Affinity = Affinity;
Modified: trunk/reactos/ntoskrnl/ke/queue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/queue.c?rev=54…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/queue.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/queue.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -149,10 +149,11 @@
IN ULONG Count OPTIONAL)
{
/* Initialize the Header */
- KeInitializeDispatcherHeader(&Queue->Header,
- QueueObject,
- sizeof(KQUEUE) / sizeof(ULONG),
- 0);
+ Queue->Header.Type = QueueObject;
+ Queue->Header.Abandoned = 0;
+ Queue->Header.Size = sizeof(KQUEUE) / sizeof(ULONG);
+ Queue->Header.SignalState = 0;
+ InitializeListHead(&(Queue->Header.WaitListHead));
/* Initialize the Lists */
InitializeListHead(&Queue->EntryListHead);
Modified: trunk/reactos/ntoskrnl/ke/semphobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/semphobj.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/semphobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/semphobj.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -24,10 +24,10 @@
IN LONG Limit)
{
/* Simply Initialize the Header */
- KeInitializeDispatcherHeader(&Semaphore->Header,
- SemaphoreObject,
- sizeof(KSEMAPHORE) / sizeof(ULONG),
- Count);
+ Semaphore->Header.Type = SemaphoreObject;
+ Semaphore->Header.Size = sizeof(KSEMAPHORE) / sizeof(ULONG);
+ Semaphore->Header.SignalState = 0;
+ InitializeListHead(&(Semaphore->Header.WaitListHead));
/* Set the Limit */
Semaphore->Limit = Limit;
Modified: trunk/reactos/ntoskrnl/ke/thrdobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/thrdobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/thrdobj.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -46,7 +46,6 @@
return (UCHAR)Result;
}
-
BOOLEAN
NTAPI
KeReadStateThread(IN PKTHREAD Thread)
@@ -54,7 +53,7 @@
ASSERT_THREAD(Thread);
/* Return signal state */
- return (BOOLEAN)Thread->DispatcherHeader.SignalState;
+ return (BOOLEAN)Thread->Header.SignalState;
}
KPRIORITY
@@ -726,10 +725,11 @@
NTSTATUS Status;
/* Initalize the Dispatcher Header */
- KeInitializeDispatcherHeader(&Thread->DispatcherHeader,
- ThreadObject,
- sizeof(KTHREAD) / sizeof(LONG),
- FALSE);
+ Thread->Header.Type = ThreadObject;
+ Thread->Header.ThreadControlFlags = 0;
+ Thread->Header.DebugActive = FALSE;
+ Thread->Header.SignalState = 0;
+ InitializeListHead(&(Thread->Header.WaitListHead));
/* Initialize the Mutant List */
InitializeListHead(&Thread->MutantListHead);
@@ -1381,11 +1381,11 @@
}
/* Signal the thread */
- Thread->DispatcherHeader.SignalState = TRUE;
- if (!IsListEmpty(&Thread->DispatcherHeader.WaitListHead))
+ Thread->Header.SignalState = TRUE;
+ if (!IsListEmpty(&Thread->Header.WaitListHead))
{
/* Unwait the threads */
- KxUnwaitThread(&Thread->DispatcherHeader, Increment);
+ KxUnwaitThread(&Thread->Header, Increment);
}
/* Remove the thread from the list */
Modified: trunk/reactos/ntoskrnl/ke/timerobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/timerobj.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/timerobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/timerobj.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -249,10 +249,12 @@
"NotificationTimer" : "SynchronizationTimer");
/* Initialize the Dispatch Header */
- KeInitializeDispatcherHeader(&Timer->Header,
- TimerNotificationObject + Type,
- sizeof(KTIMER) / sizeof(ULONG),
- FALSE);
+ Timer->Header.Type = TimerNotificationObject + Type;
+ //Timer->Header.TimerControlFlags = 0; // win does not init this field
+ Timer->Header.Hand = sizeof(KTIMER) / sizeof(ULONG);
+ Timer->Header.Inserted = 0; // win7: Timer->Header.TimerMiscFlags = 0;
+ Timer->Header.SignalState = 0;
+ InitializeListHead(&(Timer->Header.WaitListHead));
/* Initalize the Other data */
Timer->DueTime.QuadPart = 0;
Modified: trunk/reactos/ntoskrnl/ps/process.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/process.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/process.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/process.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -958,7 +958,7 @@
FoundThread = CidEntry->Object;
/* Make sure it's really a thread and this process' */
- if ((FoundThread->Tcb.DispatcherHeader.Type == ThreadObject) &&
+ if ((FoundThread->Tcb.Header.Type == ThreadObject) &&
(FoundThread->Cid.UniqueProcess == Cid->UniqueProcess))
{
/* Safe Reference and return it */
Modified: trunk/reactos/ntoskrnl/ps/thread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/thread.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/thread.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/thread.c [iso-8859-1] Fri Oct 7 16:18:52 2011
@@ -647,7 +647,7 @@
FoundThread = CidEntry->Object;
/* Make sure it's really a process */
- if (FoundThread->Tcb.DispatcherHeader.Type == ThreadObject)
+ if (FoundThread->Tcb.Header.Type == ThreadObject)
{
/* Safe Reference and return it */
if (ObReferenceObjectSafe(FoundThread))