update for HEAD-2003091401
[reactos.git] / include / ddk / kefuncs.h
index 6322bf2..c4d8d40 100644 (file)
@@ -4,7 +4,9 @@
 
 /* KERNEL FUNCTIONS ********************************************************/
 
+#ifndef KeFlushIoBuffers
 #define KeFlushIoBuffers(Mdl, ReadOperation, DmaOperation)
+#endif
 
 VOID STDCALL KeAttachProcess (struct _EPROCESS*        Process);
 
@@ -21,18 +23,31 @@ struct _KPROCESS* KeGetCurrentProcess(VOID);
 VOID STDCALL KeAcquireSpinLock (PKSPIN_LOCK    SpinLock,
                                PKIRQL          OldIrql);
 
-VOID STDCALL KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK  SpinLock);
+#ifndef __USE_W32API
 
+VOID STDCALL KeAcquireSpinLockAtDpcLevel (IN PKSPIN_LOCK       SpinLock);
+
+#define KefAcquireSpinLockAtDpcLevel KeAcquireSpinLockAtDpcLevel
+
+VOID
+STDCALL
+KeReleaseSpinLockFromDpcLevel(
+  IN PKSPIN_LOCK  SpinLock);
+
+#endif
+  
 /*
  * FUNCTION: Brings the system down in a controlled manner when an 
  * inconsistency that might otherwise cause corruption has been detected
  * ARGUMENTS:
  *           BugCheckCode = Specifies the reason for the bug check
  * RETURNS: Doesn't
+ *
+ * NOTES - please use the macro KEBUGCHECK with the same argument so the end-user
+ * knows what file/line number where the bug check occured
  */
 VOID STDCALL KeBugCheck (ULONG BugCheckCode);
 
-
 /*
  * FUNCTION: Brings the system down in a controlled manner when an 
  * inconsistency that might otherwise cause corruption has been detected
@@ -40,6 +55,9 @@ VOID STDCALL KeBugCheck (ULONG        BugCheckCode);
  *           BugCheckCode = Specifies the reason for the bug check
  *           BugCheckParameter[1-4] = Additional information about bug
  * RETURNS: Doesn't
+ *
+ * NOTES - please use the macro KEBUGCHECKEX with the same arguments so the end-user
+ * knows what file/line number where the bug check occured
  */
 VOID STDCALL KeBugCheckEx (ULONG       BugCheckCode,
                           ULONG        BugCheckParameter1,
@@ -73,26 +91,25 @@ VOID STDCALL KeEnterCriticalRegion (VOID);
  */
 VOID STDCALL KeEnterKernelDebugger (VOID);
 
-VOID STDCALL KeFlushWriteBuffer (VOID);
-
 KIRQL STDCALL KeGetCurrentIrql (VOID);
 
+#ifndef __USE_W32API
 ULONG KeGetCurrentProcessorNumber(VOID);
+ULONG KeGetDcacheFillSize(VOID);
+ULONG STDCALL KeGetPreviousMode (VOID);
+#endif
 
 struct _KTHREAD* STDCALL KeGetCurrentThread (VOID);
 
-ULONG KeGetDcacheFillSize(VOID);
-
-ULONG STDCALL KeGetPreviousMode (VOID);
+VOID STDCALL KeInitializeApc (IN PKAPC  Apc,
+       IN PKTHREAD  Thread,
+       IN UCHAR  StateIndex,
+       IN PKKERNEL_ROUTINE  KernelRoutine,
+       IN PKRUNDOWN_ROUTINE  RundownRoutine,
+       IN PKNORMAL_ROUTINE  NormalRoutine,
+       IN UCHAR  Mode,
+       IN PVOID  Context);
 
-VOID STDCALL KeInitializeApc (PKAPC                    Apc,
-                             struct _KTHREAD*          Thread,
-                             UCHAR                     StateIndex,
-                             PKKERNEL_ROUTINE  KernelRoutine,
-                             PKRUNDOWN_ROUTINE RundownRoutine,
-                             PKNORMAL_ROUTINE  NormalRoutine,
-                             UCHAR                     Mode,
-                             PVOID                     Context);
 
 /*
  * VOID
@@ -100,8 +117,10 @@ VOID STDCALL KeInitializeApc (PKAPC                        Apc,
  *      PKBUGCHECK_CALLBACK_RECORD CallbackRecord
  *      );
  */
+#ifndef KeInitializeCallbackRecord
 #define KeInitializeCallbackRecord(CallbackRecord) \
        (CallbackRecord)->State = BufferEmpty
+#endif
 
 VOID STDCALL KeInitializeDeviceQueue (PKDEVICE_QUEUE   DeviceQueue);
 
@@ -169,10 +188,10 @@ LONG STDCALL
 KeInsertQueue(IN PKQUEUE Queue,
              IN PLIST_ENTRY Entry);
 
-VOID STDCALL KeInsertQueueApc (PKAPC   Apc,
+BOOLEAN STDCALL KeInsertQueueApc (PKAPC        Apc,
                               PVOID    SystemArgument1,
                               PVOID    SystemArgument2,
-                              UCHAR    Mode);
+                KPRIORITY PriorityBoost);
 
 BOOLEAN STDCALL KeInsertQueueDpc (PKDPC        Dpc,
                                  PVOID SystemArgument1,
@@ -223,12 +242,6 @@ KeRaiseIrqlToDpcLevel (
        VOID
        );
 
-KIRQL
-STDCALL
-KeRaiseIrqlToSynchLevel (
-       VOID
-       );
-
 /*
  * FUNCTION: Raises a user mode exception
  * ARGUMENTS:
@@ -303,11 +316,13 @@ KeReleaseSpinLock (
        KIRQL           NewIrql
        );
 
+#ifndef __USE_W32API
 VOID
 STDCALL
 KeReleaseSpinLockFromDpcLevel (
        PKSPIN_LOCK     Spinlock
        );
+#endif
 
 PKDEVICE_QUEUE_ENTRY
 STDCALL
@@ -398,10 +413,10 @@ KeWaitForSingleObject (
 
 
 
-// io permission map has a 8k size
-// Each bit in the IOPM corresponds to an io port byte address. The bitmap
-// is initialized to allow IO at any port. [ all bits set ]. 
-
+/* io permission map has a 8k size
+ * Each bit in the IOPM corresponds to an io port byte address. The bitmap
+ * is initialized to allow IO at any port. [ all bits set ]. 
+ */
 typedef struct _IOPM
 {
        UCHAR Bitmap[8192];
@@ -418,7 +433,8 @@ typedef struct _IOPM
  *     is initialized to allow IO at any port. [ all bits set ]. The IOPL determines
  *     the minium privilege level required to perform IO prior to checking the permission map.
  */
-VOID Ke386SetIoAccessMap(ULONG NewMap, PIOPM *IoPermissionMap);
+BOOL STDCALL
+Ke386SetIoAccessMap(ULONG NewMap, PULONG IoPermissionMap);
 
 /*
  * FUNCTION: Queries the io permission  map.
@@ -431,7 +447,8 @@ VOID Ke386SetIoAccessMap(ULONG NewMap, PIOPM *IoPermissionMap);
  *     is initialized to allow IO at any port. [ all bits set ]. The IOPL determines
  *     the minium privilege level required to perform IO prior to checking the permission map.
  */
-VOID Ke386QueryIoAccessMap(BOOLEAN NewMap, PIOPM *IoPermissionMap);
+BOOL STDCALL
+Ke386QueryIoAccessMap(ULONG NewMap, PULONG IoPermissionMap);
 
 /*
  * FUNCTION: Set the process IOPL
@@ -439,7 +456,18 @@ VOID Ke386QueryIoAccessMap(BOOLEAN NewMap, PIOPM *IoPermissionMap);
  *     Eprocess = Pointer to a executive process object
  *     EnableIo = Specify TRUE to enable IO and FALSE to disable 
  */
-NTSTATUS Ke386IoSetAccessProcess(struct _EPROCESS* Eprocess, BOOLEAN EnableIo);
+BOOL STDCALL
+Ke386IoSetAccessProcess(struct _EPROCESS* Eprocess, BOOL EnableIo);
+
+/*
+ * FUNCTION: Sets the contents of a gdt descriptor.
+ * ARGUMENTS:
+ *     Entry = The selector to set.
+ *     Value1 = The value of the low dword of the descriptor.
+ *     Value2 = The value of the high dword of the descriptor.
+ */
+VOID
+KeSetGdtSelector(ULONG Entry, ULONG Value1, ULONG Value2);
 
 /*
  * FUNCTION: Releases a set of Global Descriptor Table Selectors