[HEADERS]
[reactos.git] / reactos / ntoskrnl / include / internal / ntoskrnl.h
index 850f9dc..41d4843 100644 (file)
@@ -1,12 +1,11 @@
-#ifndef __INCLUDE_INTERNAL_NTOSKRNL_H
-#define __INCLUDE_INTERNAL_NTOSKRNL_H
+#pragma once
 
 /*
  * Use these to place a function in a specific section of the executable
  */
 #define PLACE_IN_SECTION(s)    __attribute__((section (s)))
 #ifdef __GNUC__
-#define INIT_FUNCTION          PLACE_IN_SECTION("init")
+#define INIT_FUNCTION          PLACE_IN_SECTION("INIT")
 #define PAGE_LOCKED_FUNCTION   PLACE_IN_SECTION("pagelk")
 #define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo")
 #else
@@ -24,6 +23,8 @@
 #undef  PsGetCurrentProcess
 #define PsGetCurrentProcess _PsGetCurrentProcess
 
+#define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m)))
+
 //
 // We are very lazy on ARM -- we just import intrinsics
 // Question: Why wasn't this done for x86 too? (see fastintrlck.asm)
 #define InterlockedOr                _InterlockedOr
 #define InterlockedAnd               _InterlockedAnd
 
+//
+// Use inlined versions of fast/guarded mutex routines
+//
+#define ExEnterCriticalRegionAndAcquireFastMutexUnsafe _ExEnterCriticalRegionAndAcquireFastMutexUnsafe
+#define ExReleaseFastMutexUnsafeAndLeaveCriticalRegion _ExReleaseFastMutexUnsafeAndLeaveCriticalRegion
+#define ExAcquireFastMutex _ExAcquireFastMutex
+#define ExReleaseFastMutex _ExReleaseFastMutex
+#define ExAcquireFastMutexUnsafe _ExAcquireFastMutexUnsafe
+#define ExReleaseFastMutexUnsafe _ExReleaseFastMutexUnsafe
+#define ExTryToAcquireFastMutex _ExTryToAcquireFastMutex
+
+#define KeInitializeGuardedMutex _KeInitializeGuardedMutex
+#define KeAcquireGuardedMutex _KeAcquireGuardedMutex
+#define KeReleaseGuardedMutex _KeReleaseGuardedMutex
+#define KeAcquireGuardedMutexUnsafe _KeAcquireGuardedMutexUnsafe
+#define KeReleaseGuardedMutexUnsafe _KeReleaseGuardedMutexUnsafe
+#define KeTryToAcquireGuardedMutex _KeTryToAcquireGuardedMutex
+
 #include "ke.h"
 #include "ob.h"
 #include "mm.h"
@@ -63,6 +82,7 @@
 #include "../kdbg/kdb.h"
 #endif
 #include "dbgk.h"
+#include "spinlock.h"
 #include "tag.h"
 #include "test.h"
 #include "inbv.h"
 #include "hal.h"
 #include "arch/intrin_i.h"
 
-ULONG (*FrLdrDbgPrint)(const char *Format, ...);
-
-#include <pshpack1.h>
-/*
- * Defines a descriptor as it appears in the processor tables
- */
-typedef struct __DESCRIPTOR
-{
-  ULONG a;
-  ULONG b;
-} IDT_DESCRIPTOR, GDT_DESCRIPTOR;
-
-#include <poppack.h>
-//extern GDT_DESCRIPTOR KiGdt[256];
-
-/*
- * Initalization functions (called once by main())
- */
-BOOLEAN NTAPI ObInit(VOID);
-BOOLEAN NTAPI CmInitSystem1(VOID);
-VOID NTAPI CmShutdownSystem(VOID);
-BOOLEAN NTAPI KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock);
-
-/* FIXME - RtlpCreateUnicodeString is obsolete and should be removed ASAP! */
-BOOLEAN FASTCALL
-RtlpCreateUnicodeString(
-   IN OUT PUNICODE_STRING UniDest,
-   IN PCWSTR  Source,
-   IN POOL_TYPE PoolType);
-
-VOID
-NTAPI
-RtlpLogException(IN PEXCEPTION_RECORD ExceptionRecord,
-                 IN PCONTEXT ContextRecord,
-                 IN PVOID ContextData,
-                 IN ULONG Size);
-
 /*
  * generic information class probing code
  */
@@ -162,7 +145,7 @@ typedef struct _INFORMATION_CLASS_INFO
 
 #endif
 
-#ifndef _WIN64
+#if defined (_M_IX86) || defined(_M_AMD64)
 C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemCall) == 0x300);
 C_ASSERT(FIELD_OFFSET(KTHREAD, InitialStack) == KTHREAD_INITIAL_STACK);
 C_ASSERT(FIELD_OFFSET(KTHREAD, Teb) == KTHREAD_TEB);
@@ -174,12 +157,11 @@ C_ASSERT(FIELD_OFFSET(KTHREAD, TrapFrame) == KTHREAD_TRAP_FRAME);
 C_ASSERT(FIELD_OFFSET(KTHREAD, CallbackStack) == KTHREAD_CALLBACK_STACK);
 C_ASSERT(FIELD_OFFSET(KTHREAD, ApcState.Process) == KTHREAD_APCSTATE_PROCESS);
 C_ASSERT(FIELD_OFFSET(KPROCESS, DirectoryTableBase) == KPROCESS_DIRECTORY_TABLE_BASE);
-C_ASSERT(FIELD_OFFSET(KPCR, Tib.ExceptionList) == KPCR_EXCEPTION_LIST);
-
-C_ASSERT(FIELD_OFFSET(KPCR, Self) == KPCR_SELF);
 #endif
 
 #ifdef _M_IX86
+C_ASSERT(FIELD_OFFSET(KPCR, NtTib.ExceptionList) == KPCR_EXCEPTION_LIST);
+C_ASSERT(FIELD_OFFSET(KPCR, SelfPcr) == KPCR_SELF);
 C_ASSERT(FIELD_OFFSET(KPCR, IRR) == KPCR_IRR);
 C_ASSERT(FIELD_OFFSET(KPCR, IDR) == KPCR_IDR);
 C_ASSERT(FIELD_OFFSET(KPCR, Irql) == KPCR_IRQL);
@@ -215,5 +197,3 @@ C_ASSERT(FIELD_OFFSET(KV86M_TRAP_FRAME, orig_ebp) == TF_ORIG_EBP);
 C_ASSERT(FIELD_OFFSET(KTSS, Esp0) == KTSS_ESP0);
 C_ASSERT(FIELD_OFFSET(KTSS, IoMapBase) == KTSS_IOMAPBASE);
 #endif
-
-#endif /* INCLUDE_INTERNAL_NTOSKRNL_H */