Implemented KeSetEventBoostPriority, KeFindConfigurationEntry, KeDeregisterBugCheckCa...
authorAlex Ionescu <aionescu@gmail.com>
Wed, 13 Oct 2004 22:27:03 +0000 (22:27 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Wed, 13 Oct 2004 22:27:03 +0000 (22:27 +0000)
svn path=/trunk/; revision=11290

reactos/include/ntos/kefuncs.h
reactos/ntoskrnl/kd/kdebug.c
reactos/ntoskrnl/ke/bug.c
reactos/ntoskrnl/ke/device.c
reactos/ntoskrnl/ke/event.c
reactos/ntoskrnl/ke/main.c
reactos/ntoskrnl/ke/process.c
reactos/ntoskrnl/ke/timer.c

index 349a952..2497581 100644 (file)
@@ -15,11 +15,19 @@ extern CHAR EXPORTED KeNumberProcessors;
 extern LOADER_PARAMETER_BLOCK EXPORTED KeLoaderBlock;
 extern ULONG EXPORTED KeDcacheFlushCount;
 extern ULONG EXPORTED KeIcacheFlushCount;
+extern KAFFINITY EXPORTED KeActiveProcessors;
+extern ULONG EXPORTED KiDmaIoCoherency; /* RISC Architectures only */
+extern ULONG EXPORTED KeMaximumIncrement;
+extern ULONG EXPORTED KeMinimumIncrement;
 #else
 extern CHAR IMPORTED KeNumberProcessors;
+extern KAFFINITY IMPORTED KeActiveProcessors;
 extern LOADER_PARAMETER_BLOCK IMPORTED KeLoaderBlock;
 extern ULONG EXPORTED KeDcacheFlushCount;
 extern ULONG EXPORTED KeIcacheFlushCount;
+extern ULONG IMPORTED KiDmaIoCoherency; /* RISC Architectures only */
+extern ULONG IMPORTED KeMaximumIncrement;
+extern ULONG IMPORTED KeMinimumIncrement;
 #endif
 
 
index fbadde1..a33e8c1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: kdebug.c,v 1.55 2004/08/15 16:39:04 chorns Exp $
+/* $Id: kdebug.c,v 1.56 2004/10/13 22:27:03 ion Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -405,19 +405,6 @@ KdEnableDebugger (
        UNIMPLEMENTED;
 }
 
-/*
- * @unimplemented
- */
-BOOLEAN
-STDCALL
-KeIsAttachedProcess(
-       VOID
-       )
-{
-       UNIMPLEMENTED;
-       return FALSE;
-}
-
 /*
  * @implemented
  */
index 529316c..93d9d82 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: bug.c,v 1.46 2004/09/28 15:02:29 weiden Exp $
+/* $Id: bug.c,v 1.47 2004/10/13 22:27:03 ion Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/bug.c
@@ -50,13 +50,20 @@ KeInitializeBugCheck(VOID)
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOLEAN STDCALL
 KeDeregisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
 {
-  UNIMPLEMENTED;
-  return FALSE;
+       /* Check the Current State */
+       if (CallbackRecord->State == BufferInserted) {
+               CallbackRecord->State = BufferEmpty;
+               RemoveEntryList(&CallbackRecord->Entry);
+               return TRUE;
+       }
+       
+       /* The callback wasn't registered */
+       return FALSE;
 }
 
 /*
@@ -69,12 +76,21 @@ KeRegisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
                           ULONG Length,
                           PUCHAR Component)
 {
-  InsertTailList(&BugcheckCallbackListHead, &CallbackRecord->Entry);
-  CallbackRecord->Length = Length;
-  CallbackRecord->Buffer = Buffer;
-  CallbackRecord->Component = Component;
-  CallbackRecord->CallbackRoutine = CallbackRoutine;
-  return(TRUE);
+
+       /* Check the Current State first so we don't double-register */
+       if (CallbackRecord->State == BufferEmpty) {
+               CallbackRecord->Length = Length;
+               CallbackRecord->Buffer = Buffer;
+               CallbackRecord->Component = Component;
+               CallbackRecord->CallbackRoutine = CallbackRoutine;
+               CallbackRecord->State = BufferInserted;
+               InsertTailList(&BugcheckCallbackListHead, &CallbackRecord->Entry);
+               
+               return TRUE;
+       }
+  
+       /* The Callback was already registered */
+       return(FALSE);
 }
 
 VOID STDCALL
index d355157..b398517 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: device.c,v 1.3 2004/10/13 01:42:14 ion Exp $
+/* $Id: device.c,v 1.4 2004/10/13 22:27:03 ion Exp $
  *
  * FILE:            ntoskrnl/ke/profile.c
  * PURPOSE:         Kernel Device/Settings Functions
@@ -12,7 +12,7 @@
 #include <internal/debug.h>
 
 /*
- * @unimplemented
+ * @implemented
  */
 STDCALL
 PVOID
@@ -23,8 +23,8 @@ KeFindConfigurationEntry(
     IN PULONG RegKey
 )
 {
-       UNIMPLEMENTED;
-       return 0;
+       /* Start Search at Root */
+       return KeFindConfigurationNextEntry(Unknown, Class, Type, RegKey, NULL);
 }
 
 /*
@@ -94,7 +94,7 @@ KeFlushEntireTb(
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 STDCALL
 VOID
@@ -102,7 +102,7 @@ KeSetDmaIoCoherency(
     IN ULONG Coherency
 )
 {
-       UNIMPLEMENTED;
+       KiDmaIoCoherency = Coherency;
 }
 
 /*
@@ -120,7 +120,7 @@ KeRemoveByKeyDeviceQueueIfBusy (
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 STDCALL
 KAFFINITY
@@ -128,8 +128,7 @@ KeQueryActiveProcessors (
     VOID
     )
 {
-       UNIMPLEMENTED;
-       return 0;
+       return KeActiveProcessors;
 }
 
 
index 1e4021b..986f0b5 100644 (file)
@@ -133,7 +133,7 @@ NTSTATUS STDCALL KePulseEvent (PKEVENT              Event,
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 VOID
 STDCALL
@@ -142,7 +142,17 @@ KeSetEventBoostPriority(
        IN PKTHREAD *Thread OPTIONAL
 )
 {
-       UNIMPLEMENTED;
+       PKTHREAD WaitingThread;
+       
+       /* Get Thread that is currently waiting. First get the Wait Block, then the Thread */
+       WaitingThread = CONTAINING_RECORD(Event->Header.WaitListHead.Flink, KWAIT_BLOCK, WaitListEntry)->Thread;
+       
+       /* Return it to caller if requested */
+       if ARGUMENT_PRESENT(Thread) *Thread = WaitingThread;
+       
+       /* Reset the Quantum and Unwait the Thread */
+       WaitingThread->Quantum = WaitingThread->ApcState.Process->ThreadQuantum;
+       KeRemoveAllWaitsThread((PETHREAD)WaitingThread, STATUS_SUCCESS, TRUE);
 }
 
 /* EOF */
index 096c9e0..64a9e3d 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: main.c,v 1.198 2004/10/03 03:03:54 ion Exp $
+/* $Id: main.c,v 1.199 2004/10/13 22:27:03 ion Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/main.c
 ULONG EXPORTED NtBuildNumber = KERNEL_VERSION_BUILD;
 ULONG EXPORTED NtGlobalFlag = 0;
 CHAR  EXPORTED KeNumberProcessors;
+KAFFINITY  EXPORTED KeActiveProcessors;
 LOADER_PARAMETER_BLOCK EXPORTED KeLoaderBlock;
 ULONG EXPORTED KeDcacheFlushCount = 0;
 ULONG EXPORTED KeIcacheFlushCount = 0;
+ULONG EXPORTED KiDmaIoCoherency = 0; /* RISC Architectures only */
 #else
 /* Microsoft-style declarations */
 EXPORTED ULONG NtBuildNumber = KERNEL_VERSION_BUILD;
 EXPORTED ULONG NtGlobalFlag = 0;
 EXPORTED CHAR  KeNumberProcessors;
+EXPORTED KAFFINITY KeActiveProcessors;
 EXPORTED LOADER_PARAMETER_BLOCK KeLoaderBlock;
 EXPORTED ULONG KeDcacheFlushCount = 0;
 EXPORTED ULONG KeIcacheFlushCount = 0;
+EXPORTED ULONG KiDmaIoCoherency = 0; /* RISC Architectures only */
 #endif /* __GNUC__ */
 
 static LOADER_MODULE KeLoaderModules[64];
index b81dff0..064d6db 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: process.c,v 1.28 2004/10/13 01:42:14 ion Exp $
+/* $Id: process.c,v 1.29 2004/10/13 22:27:03 ion Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/process.c
@@ -114,7 +114,19 @@ KeDetachProcess (VOID)
 }
 
 /*
- * @unimplemented
+ * @implemented
+ */
+BOOLEAN
+STDCALL
+KeIsAttachedProcess(
+       VOID
+       )
+{
+       return KeGetCurrentThread()->ApcStateIndex;
+}
+
+/*
+ * @implemented
  */
 VOID
 STDCALL
index 10a1aa2..070829b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: timer.c,v 1.79 2004/10/01 20:09:57 hbirr Exp $
+/* $Id: timer.c,v 1.80 2004/10/13 22:27:03 ion Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -55,6 +55,17 @@ volatile ULONG KiRawTicks = 0;
  */
 #define CLOCK_INCREMENT (100000)
 
+#ifdef  __GNUC__
+ULONG EXPORTED KeMaximumIncrement = 100000;
+ULONG EXPORTED KeMinimumIncrement = 100000;
+#else
+/* Microsoft-style declarations */
+EXPORTED ULONG KeMaximumIncrement = 100000;
+EXPORTED ULONG KeMinimumIncrement = 100000;
+#endif
+
+
+
 /*
  * PURPOSE: List of timers
  */
@@ -470,7 +481,7 @@ KeQueryTickCount(PLARGE_INTEGER TickCount)
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 ULONG
 STDCALL
@@ -479,12 +490,15 @@ KeQueryRuntimeThread(
        OUT PULONG UserTime
        )
 {
-       UNIMPLEMENTED;
-       return 0;
+       /* Return the User Time */
+       *UserTime = Thread->UserTime;
+       
+       /* Return the Kernel Time */
+       return Thread->KernelTime;
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 VOID
 STDCALL
@@ -493,7 +507,10 @@ KeSetTimeIncrement(
     IN ULONG MinIncrement
 )
 {
-       UNIMPLEMENTED;
+       /* Set some Internal Variables */
+       /* FIXME: We use a harcoded CLOCK_INCREMENT. That *must* be changed */
+       KeMaximumIncrement = MaxIncrement;
+       KeMinimumIncrement = MinIncrement;
 }
 
 /*
@@ -774,7 +791,7 @@ KeSetTimeUpdateNotifyRoutine(
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 VOID
 STDCALL
@@ -782,11 +799,14 @@ KeUpdateRunTime(
        IN PKTRAP_FRAME TrapFrame
 )
 {
-       UNIMPLEMENTED;
+       KIRQL OldIrql;
+       
+       /* These are equivalent... we should just remove the Ki and stick it here... */
+       KiUpdateProcessThreadTime(OldIrql, (PKIRQ_TRAPFRAME)TrapFrame);
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 VOID 
 STDCALL
@@ -795,7 +815,10 @@ KeUpdateSystemTime(
        IN ULONG        Increment
 )
 {
-       UNIMPLEMENTED;
+       KIRQL OldIrql;
+       
+       /* These are equivalent... we should just remove the Ki and stick it here... */
+       KiUpdateSystemTime(OldIrql, (PKIRQ_TRAPFRAME)TrapFrame);
 }
 
 /*EOF*/