From 0d5652813b99f512b267563f7e03af4202e79c81 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 4 Jan 2002 13:09:37 +0000 Subject: [PATCH] Started kernel queue implementation. Added win32k support functions. svn path=/trunk/; revision=2483 --- reactos/include/ddk/kefuncs.h | 69 +++++++++--------- reactos/ntoskrnl/Makefile | 8 ++- reactos/ntoskrnl/include/internal/id.h | 1 + reactos/ntoskrnl/ke/kqueue.c | 9 +++ reactos/ntoskrnl/ke/queue.c | 97 ++++++++++++++++++++++++++ reactos/ntoskrnl/ntoskrnl.def | 20 +++--- reactos/ntoskrnl/ntoskrnl.edf | 20 +++--- reactos/ntoskrnl/ps/win32.c | 73 +++++++++++++++++++ 8 files changed, 241 insertions(+), 56 deletions(-) create mode 100644 reactos/ntoskrnl/ke/queue.c create mode 100644 reactos/ntoskrnl/ps/win32.c diff --git a/reactos/include/ddk/kefuncs.h b/reactos/include/ddk/kefuncs.h index 7f6a2736be7..b99a1be9f18 100644 --- a/reactos/include/ddk/kefuncs.h +++ b/reactos/include/ddk/kefuncs.h @@ -131,6 +131,10 @@ VOID STDCALL KeInitializeMutant(IN PKMUTANT Mutant, VOID STDCALL KeInitializeMutex (PKMUTEX Mutex, ULONG Level); +VOID STDCALL +KeInitializeQueue(IN PKQUEUE Queue, + IN ULONG Count); + VOID STDCALL KeInitializeSemaphore (PKSEMAPHORE Semaphore, LONG Count, LONG Limit); @@ -154,6 +158,14 @@ BOOLEAN STDCALL KeInsertByKeyDeviceQueue (PKDEVICE_QUEUE DeviceQueue, BOOLEAN STDCALL KeInsertDeviceQueue (PKDEVICE_QUEUE DeviceQueue, PKDEVICE_QUEUE_ENTRY DeviceQueueEntry); +LONG STDCALL +KeInsertHeadQueue(IN PKQUEUE Queue, + IN PLIST_ENTRY Entry); + +LONG STDCALL +KeInsertQueue(IN PKQUEUE Queue, + IN PLIST_ENTRY Entry); + VOID STDCALL KeInsertQueueApc (PKAPC Apc, PVOID SystemArgument1, PVOID SystemArgument2, @@ -234,23 +246,17 @@ KeReadStateEvent ( LONG STDCALL KeReadStateMutant(IN PKMUTANT Mutant); -LONG -STDCALL -KeReadStateMutex ( - PKMUTEX Mutex - ); +LONG STDCALL +KeReadStateMutex(IN PKMUTEX Mutex); -LONG -STDCALL -KeReadStateSemaphore ( - PKSEMAPHORE Semaphore - ); +LONG STDCALL +KeReadStateQueue(IN PKQUEUE Queue); -BOOLEAN -STDCALL -KeReadStateTimer ( - PKTIMER Timer - ); +LONG STDCALL +KeReadStateSemaphore(IN PKSEMAPHORE Semaphore); + +BOOLEAN STDCALL +KeReadStateTimer(IN PKTIMER Timer); BOOLEAN STDCALL @@ -313,27 +319,24 @@ KeRemoveDeviceQueue ( PKDEVICE_QUEUE DeviceQueue ); -BOOLEAN -STDCALL -KeRemoveEntryDeviceQueue ( - PKDEVICE_QUEUE DeviceQueue, - PKDEVICE_QUEUE_ENTRY DeviceQueueEntry - ); +BOOLEAN STDCALL +KeRemoveEntryDeviceQueue(PKDEVICE_QUEUE DeviceQueue, + PKDEVICE_QUEUE_ENTRY DeviceQueueEntry); -BOOLEAN -STDCALL -KeRemoveQueueDpc ( - PKDPC Dpc - ); +PLIST_ENTRY STDCALL +KeRemoveQueue(IN PKQUEUE Queue, + IN KPROCESSOR_MODE WaitMode, + IN PLARGE_INTEGER Timeout OPTIONAL); -LONG -STDCALL -KeResetEvent ( - PKEVENT Event - ); +BOOLEAN STDCALL +KeRemoveQueueDpc(IN PKDPC Dpc); -LONG STDCALL KeSetBasePriorityThread (struct _KTHREAD* Thread, - LONG Increment); +LONG STDCALL +KeResetEvent(IN PKEVENT Event); + +LONG STDCALL +KeSetBasePriorityThread(struct _KTHREAD* Thread, + LONG Increment); LONG STDCALL diff --git a/reactos/ntoskrnl/Makefile b/reactos/ntoskrnl/Makefile index 462ff284a11..b6cdf77c3eb 100644 --- a/reactos/ntoskrnl/Makefile +++ b/reactos/ntoskrnl/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.62 2002/01/03 14:51:25 ekohl Exp $ +# $Id: Makefile,v 1.63 2002/01/04 13:09:36 ekohl Exp $ # # ReactOS Operating System # @@ -125,7 +125,8 @@ OBJECTS_KE = \ ke/spinlock.o \ ke/timer.o \ ke/wait.o \ - ke/kthread.o + ke/kthread.o \ + ke/queue.o # Memory Manager (Mm) OBJECTS_MM = \ @@ -216,7 +217,8 @@ OBJECTS_PS = \ ps/thread.o \ ps/tinfo.o \ ps/debug.o \ - ps/suspend.o + ps/suspend.o \ + ps/win32.o # Executive Subsystem (Ex) OBJECTS_EX = \ diff --git a/reactos/ntoskrnl/include/internal/id.h b/reactos/ntoskrnl/include/internal/id.h index 0ad694da4a0..43a29588163 100644 --- a/reactos/ntoskrnl/include/internal/id.h +++ b/reactos/ntoskrnl/include/internal/id.h @@ -14,5 +14,6 @@ #define InternalMutexType (InternalBaseType + 9) #define InternalNotificationTimer (InternalBaseType + 10) #define InternalSynchronizationTimer (InternalBaseType + 11) +#define InternalQueueType (InternalBaseType + 12) diff --git a/reactos/ntoskrnl/ke/kqueue.c b/reactos/ntoskrnl/ke/kqueue.c index 37536becdcf..6c8d685f23c 100644 --- a/reactos/ntoskrnl/ke/kqueue.c +++ b/reactos/ntoskrnl/ke/kqueue.c @@ -187,3 +187,12 @@ KeInsertDeviceQueue ( KeReleaseSpinLock(&DeviceQueue->Lock,oldlvl); return(TRUE); } + + +BOOLEAN STDCALL +KeRemoveEntryDeviceQueue(PKDEVICE_QUEUE DeviceQueue, + PKDEVICE_QUEUE_ENTRY DeviceQueueEntry) +{ + UNIMPLEMENTED; + return(FALSE); +} diff --git a/reactos/ntoskrnl/ke/queue.c b/reactos/ntoskrnl/ke/queue.c new file mode 100644 index 00000000000..8889e3cae02 --- /dev/null +++ b/reactos/ntoskrnl/ke/queue.c @@ -0,0 +1,97 @@ +/* + * ReactOS kernel + * Copyright (C) 1998, 1999, 2000, 2001, 2002 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: queue.c,v 1.1 2002/01/04 13:08:39 ekohl Exp $ + * + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ke/queue.c + * PURPOSE: Implements kernel queues + * PROGRAMMER: Eric Kohl (ekohl@rz-online.de) + * UPDATE HISTORY: + * Created 04/01/2002 + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include + +#define NDEBUG +#include + +/* FUNCTIONS *****************************************************************/ + +VOID STDCALL +KeInitializeQueue(IN PKQUEUE Queue, + IN ULONG Count OPTIONAL) +{ + KeInitializeDispatcherHeader(&Queue->Header, + InternalQueueType, + sizeof(KQUEUE)/sizeof(ULONG), + 0); + InitializeListHead(&Queue->EntryListHead); + InitializeListHead(&Queue->ThreadListEntry); + Queue->CurrentCount = 0; + Queue->MaximumCount = (Count == 0) ? KeNumberProcessors : Count; +} + + +LONG STDCALL +KeReadStateQueue(IN PKQUEUE Queue) +{ + return(Queue->Header.SignalState); +} + + +LONG STDCALL +KeInsertHeadQueue(IN PKQUEUE Queue, + IN PLIST_ENTRY Entry) +{ + UNIMPLEMENTED; + return 0; +} + + +LONG STDCALL +KeInsertQueue(IN PKQUEUE Queue, + IN PLIST_ENTRY Entry) +{ + UNIMPLEMENTED; + return 0; +} + + +PLIST_ENTRY STDCALL +KeRemoveQueue(IN PKQUEUE Queue, + IN KPROCESSOR_MODE WaitMode, + IN PLARGE_INTEGER Timeout OPTIONAL) +{ + UNIMPLEMENTED; + return NULL; +} + + +PLIST_ENTRY STDCALL +KeRundownQueue(IN PKQUEUE Queue) +{ + UNIMPLEMENTED; + return NULL; +} + +/* EOF */ diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index 38e7dea38b6..b1893747b20 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.def,v 1.122 2002/01/03 18:02:34 ekohl Exp $ +; $Id: ntoskrnl.def,v 1.123 2002/01/04 13:09:37 ekohl Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -354,15 +354,15 @@ KeInitializeEvent@12 KeInitializeInterrupt@44 KeInitializeMutant@8 KeInitializeMutex@8 -;KeInitializeQueue +KeInitializeQueue@8 KeInitializeSemaphore@12 KeInitializeSpinLock@4 KeInitializeTimer@4 KeInitializeTimerEx@8 KeInsertByKeyDeviceQueue@12 KeInsertDeviceQueue@8 -;KeInsertHeadQueue -;KeInsertQueue +KeInsertHeadQueue@8 +KeInsertQueue@8 KeInsertQueueApc@16 KeInsertQueueDpc@12 ;KeIsExecutingDpc @@ -379,7 +379,7 @@ KeQueryTimeIncrement@0 KeReadStateEvent@4 KeReadStateMutant@4 KeReadStateMutex@4 -;KeReadStateQueue +KeReadStateQueue@4 KeReadStateSemaphore@4 KeReadStateTimer@4 KeRegisterBugCheckCallback@20 @@ -389,12 +389,12 @@ KeReleaseSemaphore@16 KeReleaseSpinLockFromDpcLevel@4 KeRemoveByKeyDeviceQueue@8 KeRemoveDeviceQueue@4 -;KeRemoveEntryDeviceQueue -;KeRemoveQueue +KeRemoveEntryDeviceQueue@8 +KeRemoveQueue@12 KeRemoveQueueDpc@4 KeResetEvent@4 ;KeRestoreFloatingPointState -;KeRundownQueue +KeRundownQueue@4 ;KeSaveFloatingPointState KeServiceDescriptorTable DATA ;KeSetAffinityThread @@ -590,9 +590,9 @@ PsAssignImpersonationToken@8 ;PsChargePoolQuota@12 PsCreateSystemProcess@12 PsCreateSystemThread@28 -;PsCreateWin32Process@4 +PsCreateWin32Process@4 PsDispatchThread@4 -;PsEstablishWin32Callouts@24 +PsEstablishWin32Callouts@24 PsGetCurrentProcessId@0 PsGetCurrentThreadId@0 PsGetCurrentThread@0 diff --git a/reactos/ntoskrnl/ntoskrnl.edf b/reactos/ntoskrnl/ntoskrnl.edf index 6d23e6262d9..7f6312ff059 100644 --- a/reactos/ntoskrnl/ntoskrnl.edf +++ b/reactos/ntoskrnl/ntoskrnl.edf @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.edf,v 1.108 2002/01/03 18:02:34 ekohl Exp $ +; $Id: ntoskrnl.edf,v 1.109 2002/01/04 13:09:37 ekohl Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -354,15 +354,15 @@ KeInitializeEvent=KeInitializeEvent@12 KeInitializeInterrupt=KeInitializeInterrupt@44 KeInitializeMutant=KeInitializeMutant@8 KeInitializeMutex=KeInitializeMutex@8 -;KeInitializeQueue +KeInitializeQueue=KeInitializeQueue@8 KeInitializeSemaphore=KeInitializeSemaphore@12 KeInitializeSpinLock=KeInitializeSpinLock@4 KeInitializeTimer=KeInitializeTimer@4 KeInitializeTimerEx=KeInitializeTimerEx@8 KeInsertByKeyDeviceQueue=KeInsertByKeyDeviceQueue@12 KeInsertDeviceQueue=KeInsertDeviceQueue@8 -;KeInsertHeadQueue -;KeInsertQueue +KeInsertHeadQueue=KeInsertHeadQueue@8 +KeInsertQueue=KeInsertQueue@8 KeInsertQueueApc=KeInsertQueueApc@16 KeInsertQueueDpc=KeInsertQueueDpc@12 ;KeIsExecutingDpc @@ -379,7 +379,7 @@ KeQueryTimeIncrement=KeQueryTimeIncrement@0 KeReadStateEvent=KeReadStateEvent@4 KeReadStateMutant=KeReadStateMutant@4 KeReadStateMutex=KeReadStateMutex@4 -;KeReadStateQueue +KeReadStateQueue=KeReadStateQueue@4 KeReadStateSemaphore=KeReadStateSemaphore@4 KeReadStateTimer=KeReadStateTimer@4 KeRegisterBugCheckCallback=KeRegisterBugCheckCallback@20 @@ -389,12 +389,12 @@ KeReleaseSemaphore=KeReleaseSemaphore@16 KeReleaseSpinLockFromDpcLevel=KeReleaseSpinLockFromDpcLevel@4 KeRemoveByKeyDeviceQueue=KeRemoveByKeyDeviceQueue@8 KeRemoveDeviceQueue=KeRemoveDeviceQueue@4 -;KeRemoveEntryDeviceQueue -;KeRemoveQueue +KeRemoveEntryDeviceQueue=KeRemoveEntryDeviceQueue@8 +KeRemoveQueue=KeRemoveQueue@12 KeRemoveQueueDpc=KeRemoveQueueDpc@4 KeResetEvent=KeResetEvent@4 ;KeRestoreFloatingPointState -;KeRundownQueue +KeRundownQueue=KeRundownQueue@4 ;KeSaveFloatingPointState KeServiceDescriptorTable DATA ;KeSetAffinityThread @@ -590,9 +590,9 @@ PsAssignImpersonationToken=PsAssignImpersonationToken@8 ;PsChargePoolQuota=PsChargePoolQuota@12 PsCreateSystemProcess=PsCreateSystemProcess@12 PsCreateSystemThread=PsCreateSystemThread@28 -;PsCreateWin32Process=PsCreateWin32Process@4 +PsCreateWin32Process=PsCreateWin32Process@4 PsDispatchThread=PsDispatchThread@4 -;PsEstablishWin32Callouts=PsEstablishWin32Callouts@24 +PsEstablishWin32Callouts=PsEstablishWin32Callouts@24 PsGetCurrentProcessId=PsGetCurrentProcessId@0 PsGetCurrentThreadId=PsGetCurrentThreadId@0 PsGetCurrentThread=PsGetCurrentThread@0 diff --git a/reactos/ntoskrnl/ps/win32.c b/reactos/ntoskrnl/ps/win32.c new file mode 100644 index 00000000000..2bba1155423 --- /dev/null +++ b/reactos/ntoskrnl/ps/win32.c @@ -0,0 +1,73 @@ +/* + * ReactOS kernel + * Copyright (C) 2002 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: win32.c,v 1.1 2002/01/04 13:09:11 ekohl Exp $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ps/win32.c + * PURPOSE: win32k support + * PROGRAMMER: Eric Kohl (ekohl@rz-online.de) + * REVISION HISTORY: + * 04/01/2002: Created + */ + +/* INCLUDES ****************************************************************/ + +#include +#include + +/* TYPES *******************************************************************/ + +/* GLOBALS ******************************************************************/ + +static ULONG PspWin32ProcessSize = 0; + + +/* FUNCTIONS ***************************************************************/ + +NTSTATUS STDCALL +PsCreateWin32Process(PEPROCESS Process) +{ + if (Process->Win32Process != NULL) + return(STATUS_SUCCESS); + + Process->Win32Process = ExAllocatePool(NonPagedPool, + PspWin32ProcessSize); + if (Process->Win32Process == NULL) + return(STATUS_NO_MEMORY); + + RtlZeroMemory(Process->Win32Process, + PspWin32ProcessSize); + + return(STATUS_SUCCESS); +} + + +VOID STDCALL +PsEstablishWin32Callouts(PVOID Param1, + PVOID Param2, + PVOID Param3, + PVOID Param4, + PVOID Param5, + ULONG W32ProcessSize) +{ + PspWin32ProcessSize = W32ProcessSize; +} + +/* EOF */ -- 2.17.1