[ros-diffs] [tkreuzer] 55504: [XDK/DDK] Slightly reorganize architecture dependent headers, so that ASSERT can be used [CRT] Use some definitions only for vista+, since 2k3 msvcrt doesn't have them

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Feb 8 22:15:12 UTC 2012


Author: tkreuzer
Date: Wed Feb  8 22:15:06 2012
New Revision: 55504

URL: http://svn.reactos.org/svn/reactos?rev=55504&view=rev
Log:
[XDK/DDK]
Slightly reorganize architecture dependent headers, so that ASSERT can be used
[CRT]
Use some definitions only for vista+, since 2k3 msvcrt doesn't have them

Modified:
    trunk/reactos/include/crt/math.h
    trunk/reactos/include/ddk/wdm.h
    trunk/reactos/include/xdk/kefuncs.h
    trunk/reactos/include/xdk/wdm.template.h

Modified: trunk/reactos/include/crt/math.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/math.h?rev=55504&r1=55503&r2=55504&view=diff
==============================================================================
--- trunk/reactos/include/crt/math.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/math.h [iso-8859-1] Wed Feb  8 22:15:06 2012
@@ -124,8 +124,9 @@
   __CRT_INLINE long double tanl(long double x) { return (tan((double)x)); }
 #endif
 
-#if defined(__x86_64) || defined(_M_AMD64) || \
-    defined (__ia64__) || defined (_M_IA64)
+#if (_WIN32_WINNT >= 0x600) && \
+    (defined(__x86_64) || defined(_M_AMD64) || \
+     defined (__ia64__) || defined (_M_IA64))
   _CRTIMP float __cdecl acosf(float x);
   _CRTIMP float __cdecl asinf(float x);
   _CRTIMP float __cdecl atanf(float x);

Modified: trunk/reactos/include/ddk/wdm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=55504&r1=55503&r2=55504&view=diff
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Wed Feb  8 22:15:06 2012
@@ -1596,567 +1596,6 @@
 extern PCCHAR KeNumberProcessors;
 #endif
 
-
-
-#if defined(_M_IX86)
-/** Kernel definitions for x86 **/
-
-/* Interrupt request levels */
-#define PASSIVE_LEVEL           0
-#define LOW_LEVEL               0
-#define APC_LEVEL               1
-#define DISPATCH_LEVEL          2
-#define CMCI_LEVEL              5
-#define PROFILE_LEVEL           27
-#define CLOCK1_LEVEL            28
-#define CLOCK2_LEVEL            28
-#define IPI_LEVEL               29
-#define POWER_LEVEL             30
-#define HIGH_LEVEL              31
-#define CLOCK_LEVEL             CLOCK2_LEVEL
-
-#define KIP0PCRADDRESS          0xffdff000
-#define KI_USER_SHARED_DATA     0xffdf0000
-#define SharedUserData          ((KUSER_SHARED_DATA * CONST)KI_USER_SHARED_DATA)
-
-#define PAGE_SIZE               0x1000
-#define PAGE_SHIFT              12L
-#define KeGetDcacheFillSize()   1L
-
-#define EFLAG_SIGN              0x8000
-#define EFLAG_ZERO              0x4000
-#define EFLAG_SELECT            (EFLAG_SIGN | EFLAG_ZERO)
-
-#define RESULT_NEGATIVE         ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
-#define RESULT_ZERO             ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
-#define RESULT_POSITIVE         ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
-
-
-typedef struct _KFLOATING_SAVE {
-  ULONG ControlWord;
-  ULONG StatusWord;
-  ULONG ErrorOffset;
-  ULONG ErrorSelector;
-  ULONG DataOffset;
-  ULONG DataSelector;
-  ULONG Cr0NpxState;
-  ULONG Spare1;
-} KFLOATING_SAVE, *PKFLOATING_SAVE;
-
-extern NTKERNELAPI volatile KSYSTEM_TIME KeTickCount;
-
-#define YieldProcessor _mm_pause
-
-FORCEINLINE
-VOID
-KeMemoryBarrier(VOID)
-{
-  LONG Barrier, *Dummy = &Barrier;
-  UNREFERENCED_LOCAL_VARIABLE(Dummy);
-
-#if defined(__GNUC__)
-  __asm__ __volatile__ ("xchg %%eax, %0" : : "m" (Barrier) : "%eax");
-#elif defined(_MSC_VER)
-  __asm xchg [Barrier], eax
-#endif
-}
-
-#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
-
-_IRQL_requires_max_(HIGH_LEVEL)
-_IRQL_saves_
-NTHALAPI
-KIRQL
-NTAPI
-KeGetCurrentIrql(VOID);
-
-_IRQL_requires_max_(HIGH_LEVEL)
-NTHALAPI
-VOID
-FASTCALL
-KfLowerIrql(
-  _In_ _IRQL_restores_ _Notliteral_ KIRQL NewIrql);
-#define KeLowerIrql(a) KfLowerIrql(a)
-
-_IRQL_requires_max_(HIGH_LEVEL)
-_IRQL_raises_(NewIrql)
-_IRQL_saves_
-NTHALAPI
-KIRQL
-FASTCALL
-KfRaiseIrql(
-  _In_ KIRQL NewIrql);
-#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
-
-_IRQL_requires_max_(DISPATCH_LEVEL)
-_IRQL_saves_
-_IRQL_raises_(DISPATCH_LEVEL)
-NTHALAPI
-KIRQL
-NTAPI
-KeRaiseIrqlToDpcLevel(VOID);
-
-NTHALAPI
-KIRQL
-NTAPI
-KeRaiseIrqlToSynchLevel(VOID);
-
-_Requires_lock_not_held_(*SpinLock)
-_Acquires_lock_(*SpinLock)
-_IRQL_requires_max_(DISPATCH_LEVEL)
-_IRQL_saves_
-_IRQL_raises_(DISPATCH_LEVEL)
-NTHALAPI
-KIRQL
-FASTCALL
-KfAcquireSpinLock(
-  _Inout_ PKSPIN_LOCK SpinLock);
-#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a)
-
-_Requires_lock_held_(*SpinLock)
-_Releases_lock_(*SpinLock)
-_IRQL_requires_(DISPATCH_LEVEL)
-NTHALAPI
-VOID
-FASTCALL
-KfReleaseSpinLock(
-  _Inout_ PKSPIN_LOCK SpinLock,
-  _In_ _IRQL_restores_ KIRQL NewIrql);
-#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b)
-
-_Requires_lock_not_held_(*SpinLock)
-_Acquires_lock_(*SpinLock)
-_IRQL_requires_min_(DISPATCH_LEVEL)
-NTKERNELAPI
-VOID
-FASTCALL
-KefAcquireSpinLockAtDpcLevel(
-  _Inout_ PKSPIN_LOCK SpinLock);
-#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
-
-_Requires_lock_held_(*SpinLock)
-_Releases_lock_(*SpinLock)
-_IRQL_requires_min_(DISPATCH_LEVEL)
-NTKERNELAPI
-VOID
-FASTCALL
-KefReleaseSpinLockFromDpcLevel(
-  _Inout_ PKSPIN_LOCK SpinLock);
-#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
-
-NTSYSAPI
-PKTHREAD
-NTAPI
-KeGetCurrentThread(VOID);
-
-_Always_(_Post_satisfies_(return<=0))
-_Must_inspect_result_
-_IRQL_requires_max_(DISPATCH_LEVEL)
-_Kernel_float_saved_
-_At_(*FloatSave, _Kernel_requires_resource_not_held_(FloatState) _Kernel_acquires_resource_(FloatState))
-NTKERNELAPI
-NTSTATUS
-NTAPI
-KeSaveFloatingPointState(
-  _Out_ PKFLOATING_SAVE FloatSave);
-
-_Success_(1)
-_Kernel_float_restored_
-_At_(*FloatSave, _Kernel_requires_resource_held_(FloatState) _Kernel_releases_resource_(FloatState))
-NTKERNELAPI
-NTSTATUS
-NTAPI
-KeRestoreFloatingPointState(
-  _In_ PKFLOATING_SAVE FloatSave);
-
-/* VOID
- * KeFlushIoBuffers(
- *   IN PMDL Mdl,
- *   IN BOOLEAN ReadOperation,
- *   IN BOOLEAN DmaOperation)
- */
-#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
-
-/* x86 and x64 performs a 0x2C interrupt */
-#define DbgRaiseAssertionFailure __int2c
-
-FORCEINLINE
-VOID
-_KeQueryTickCount(
-  OUT PLARGE_INTEGER CurrentCount)
-{
-  for (;;) {
-#ifdef NONAMELESSUNION
-    CurrentCount->s.HighPart = KeTickCount.High1Time;
-    CurrentCount->s.LowPart = KeTickCount.LowPart;
-    if (CurrentCount->s.HighPart == KeTickCount.High2Time) break;
-#else
-    CurrentCount->HighPart = KeTickCount.High1Time;
-    CurrentCount->LowPart = KeTickCount.LowPart;
-    if (CurrentCount->HighPart == KeTickCount.High2Time) break;
-#endif
-    YieldProcessor();
-  }
-}
-#define KeQueryTickCount(CurrentCount) _KeQueryTickCount(CurrentCount)
-
-
-
-
-
-#elif defined(_M_AMD64)
-/** Kernel definitions for AMD64 **/
-
-/* Interrupt request levels */
-#define PASSIVE_LEVEL           0
-#define LOW_LEVEL               0
-#define APC_LEVEL               1
-#define DISPATCH_LEVEL          2
-#define CMCI_LEVEL              5
-#define CLOCK_LEVEL             13
-#define IPI_LEVEL               14
-#define DRS_LEVEL               14
-#define POWER_LEVEL             14
-#define PROFILE_LEVEL           15
-#define HIGH_LEVEL              15
-
-#define KI_USER_SHARED_DATA     0xFFFFF78000000000ULL
-#define SharedUserData          ((PKUSER_SHARED_DATA const)KI_USER_SHARED_DATA)
-#define SharedInterruptTime     (KI_USER_SHARED_DATA + 0x8)
-#define SharedSystemTime        (KI_USER_SHARED_DATA + 0x14)
-#define SharedTickCount         (KI_USER_SHARED_DATA + 0x320)
-
-#define PAGE_SIZE               0x1000
-#define PAGE_SHIFT              12L
-
-#define EFLAG_SIGN              0x8000
-#define EFLAG_ZERO              0x4000
-#define EFLAG_SELECT            (EFLAG_SIGN | EFLAG_ZERO)
-
-typedef struct _KFLOATING_SAVE {
-  ULONG Dummy;
-} KFLOATING_SAVE, *PKFLOATING_SAVE;
-
-typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
-
-#define KeQueryInterruptTime() \
-    (*(volatile ULONG64*)SharedInterruptTime)
-
-#define KeQuerySystemTime(CurrentCount) \
-    *(ULONG64*)(CurrentCount) = *(volatile ULONG64*)SharedSystemTime
-
-#define KeQueryTickCount(CurrentCount) \
-    *(ULONG64*)(CurrentCount) = *(volatile ULONG64*)SharedTickCount
-
-#define KeGetDcacheFillSize() 1L
-
-#define YieldProcessor _mm_pause
-#define FastFence __faststorefence
-#define LoadFence _mm_lfence
-#define MemoryFence _mm_mfence
-#define StoreFence _mm_sfence
-#define LFENCE_ACQUIRE() LoadFence()
-
-FORCEINLINE
-VOID
-KeMemoryBarrier(VOID)
-{
-  // FIXME: Do we really need lfence after the __faststorefence ?
-  FastFence();
-  LFENCE_ACQUIRE();
-}
-
-#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
-
-FORCEINLINE
-KIRQL
-KeGetCurrentIrql(VOID)
-{
-  return (KIRQL)__readcr8();
-}
-
-FORCEINLINE
-VOID
-KeLowerIrql(IN KIRQL NewIrql)
-{
-  ASSERT((KIRQL)__readcr8() >= NewIrql);
-  __writecr8(NewIrql);
-}
-
-FORCEINLINE
-KIRQL
-KfRaiseIrql(IN KIRQL NewIrql)
-{
-  KIRQL OldIrql;
-
-  OldIrql = (KIRQL)__readcr8();
-  ASSERT(OldIrql <= NewIrql);
-  __writecr8(NewIrql);
-  return OldIrql;
-}
-#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
-
-FORCEINLINE
-KIRQL
-KeRaiseIrqlToDpcLevel(VOID)
-{
-  return KfRaiseIrql(DISPATCH_LEVEL);
-}
-
-FORCEINLINE
-KIRQL
-KeRaiseIrqlToSynchLevel(VOID)
-{
-  return KfRaiseIrql(12); // SYNCH_LEVEL = IPI_LEVEL - 2
-}
-
-FORCEINLINE
-PKTHREAD
-KeGetCurrentThread(VOID)
-{
-  return (struct _KTHREAD *)__readgsqword(0x188);
-}
-
-FORCEINLINE
-NTSTATUS
-KeSaveFloatingPointState(PVOID FloatingState)
-{
-  UNREFERENCED_PARAMETER(FloatingState);
-  return STATUS_SUCCESS;
-}
-
-FORCEINLINE
-NTSTATUS
-KeRestoreFloatingPointState(PVOID FloatingState)
-{
-  UNREFERENCED_PARAMETER(FloatingState);
-  return STATUS_SUCCESS;
-}
-
-/* VOID
- * KeFlushIoBuffers(
- *   IN PMDL Mdl,
- *   IN BOOLEAN ReadOperation,
- *   IN BOOLEAN DmaOperation)
- */
-#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
-
-/* x86 and x64 performs a 0x2C interrupt */
-#define DbgRaiseAssertionFailure __int2c
-
-#elif defined(_M_IA64)
-/** Kernel definitions for IA64 **/
-
-/* Interrupt request levels */
-#define PASSIVE_LEVEL           0
-#define LOW_LEVEL               0
-#define APC_LEVEL               1
-#define DISPATCH_LEVEL          2
-#define CMC_LEVEL               3
-#define DEVICE_LEVEL_BASE       4
-#define PC_LEVEL                12
-#define IPI_LEVEL               14
-#define DRS_LEVEL               14
-#define CLOCK_LEVEL             13
-#define POWER_LEVEL             15
-#define PROFILE_LEVEL           15
-#define HIGH_LEVEL              15
-
-#define KI_USER_SHARED_DATA ((ULONG_PTR)(KADDRESS_BASE + 0xFFFE0000))
-extern volatile LARGE_INTEGER KeTickCount;
-
-#define PAUSE_PROCESSOR __yield();
-
-FORCEINLINE
-VOID
-KeFlushWriteBuffer(VOID)
-{
-  __mf ();
-  return;
-}
-
-NTSYSAPI
-PKTHREAD
-NTAPI
-KeGetCurrentThread(VOID);
-
-
-#elif defined(_M_PPC)
-
-/* Interrupt request levels */
-#define PASSIVE_LEVEL                      0
-#define LOW_LEVEL                          0
-#define APC_LEVEL                          1
-#define DISPATCH_LEVEL                     2
-#define PROFILE_LEVEL                     27
-#define CLOCK1_LEVEL                      28
-#define CLOCK2_LEVEL                      28
-#define IPI_LEVEL                         29
-#define POWER_LEVEL                       30
-#define HIGH_LEVEL                        31
-
-//
-// Used to contain PFNs and PFN counts
-//
-typedef ULONG PFN_COUNT;
-typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
-typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
-
-
-typedef struct _KFLOATING_SAVE {
-  ULONG Dummy;
-} KFLOATING_SAVE, *PKFLOATING_SAVE;
-
-typedef struct _KPCR_TIB {
-  PVOID ExceptionList;         /* 00 */
-  PVOID StackBase;             /* 04 */
-  PVOID StackLimit;            /* 08 */
-  PVOID SubSystemTib;          /* 0C */
-  _ANONYMOUS_UNION union {
-    PVOID FiberData;           /* 10 */
-    ULONG Version;             /* 10 */
-  } DUMMYUNIONNAME;
-  PVOID ArbitraryUserPointer;  /* 14 */
-  struct _KPCR_TIB *Self;       /* 18 */
-} KPCR_TIB, *PKPCR_TIB;         /* 1C */
-
-#define PCR_MINOR_VERSION 1
-#define PCR_MAJOR_VERSION 1
-
-typedef struct _KPCR {
-  KPCR_TIB Tib;                /* 00 */
-  struct _KPCR *Self;          /* 1C */
-  struct _KPRCB *Prcb;         /* 20 */
-  KIRQL Irql;                  /* 24 */
-  ULONG IRR;                   /* 28 */
-  ULONG IrrActive;             /* 2C */
-  ULONG IDR;                   /* 30 */
-  PVOID KdVersionBlock;        /* 34 */
-  PUSHORT IDT;                 /* 38 */
-  PUSHORT GDT;                 /* 3C */
-  struct _KTSS *TSS;           /* 40 */
-  USHORT MajorVersion;         /* 44 */
-  USHORT MinorVersion;         /* 46 */
-  KAFFINITY SetMember;         /* 48 */
-  ULONG StallScaleFactor;      /* 4C */
-  UCHAR SpareUnused;           /* 50 */
-  UCHAR Number;                /* 51 */
-} KPCR, *PKPCR;                /* 54 */
-
-#define KeGetPcr()                      PCR
-
-#define YieldProcessor() __asm__ __volatile__("nop");
-
-FORCEINLINE
-ULONG
-NTAPI
-KeGetCurrentProcessorNumber(VOID)
-{
-  ULONG Number;
-  __asm__ __volatile__ (
-    "lwz %0, %c1(12)\n"
-    : "=r" (Number)
-    : "i" (FIELD_OFFSET(KPCR, Number))
-  );
-  return Number;
-}
-
-NTHALAPI
-VOID
-FASTCALL
-KfLowerIrql(
-  IN KIRQL NewIrql);
-#define KeLowerIrql(a) KfLowerIrql(a)
-
-NTHALAPI
-KIRQL
-FASTCALL
-KfRaiseIrql(
-  IN KIRQL NewIrql);
-#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
-
-NTHALAPI
-KIRQL
-NTAPI
-KeRaiseIrqlToDpcLevel(VOID);
-
-NTHALAPI
-KIRQL
-NTAPI
-KeRaiseIrqlToSynchLevel(VOID);
-
-
-
-#elif defined(_M_MIPS)
-#error MIPS Headers are totally incorrect
-
-//
-// Used to contain PFNs and PFN counts
-//
-typedef ULONG PFN_COUNT;
-typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
-typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
-
-#define PASSIVE_LEVEL                      0
-#define APC_LEVEL                          1
-#define DISPATCH_LEVEL                     2
-#define PROFILE_LEVEL                     27
-#define IPI_LEVEL                         29
-#define HIGH_LEVEL                        31
-
-typedef struct _KPCR {
-  struct _KPRCB *Prcb;         /* 20 */
-  KIRQL Irql;                  /* 24 */
-  ULONG IRR;                   /* 28 */
-  ULONG IDR;                   /* 30 */
-} KPCR, *PKPCR;
-
-#define KeGetPcr()                      PCR
-
-typedef struct _KFLOATING_SAVE {
-} KFLOATING_SAVE, *PKFLOATING_SAVE;
-
-static __inline
-ULONG
-NTAPI
-KeGetCurrentProcessorNumber(VOID)
-{
-  return 0;
-}
-
-#define YieldProcessor() __asm__ __volatile__("nop");
-
-#define KeLowerIrql(a) KfLowerIrql(a)
-#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
-
-NTKERNELAPI
-VOID
-NTAPI
-KfLowerIrql(
-  IN KIRQL NewIrql);
-
-NTKERNELAPI
-KIRQL
-NTAPI
-KfRaiseIrql(
-  IN KIRQL NewIrql);
-
-NTKERNELAPI
-KIRQL
-NTAPI
-KeRaiseIrqlToDpcLevel(VOID);
-
-NTKERNELAPI
-KIRQL
-NTAPI
-KeRaiseIrqlToSynchLevel(VOID);
-
-
-#elif defined(_M_ARM)
-#include <armddk.h>
-#else
-#error Unknown Architecture
-#endif
 
 /******************************************************************************
  *                         Memory manager Types                               *
@@ -10065,6 +9504,566 @@
 /******************************************************************************
  *                              Kernel Functions                              *
  ******************************************************************************/
+#if defined(_M_IX86)
+/** Kernel definitions for x86 **/
+
+/* Interrupt request levels */
+#define PASSIVE_LEVEL           0
+#define LOW_LEVEL               0
+#define APC_LEVEL               1
+#define DISPATCH_LEVEL          2
+#define CMCI_LEVEL              5
+#define PROFILE_LEVEL           27
+#define CLOCK1_LEVEL            28
+#define CLOCK2_LEVEL            28
+#define IPI_LEVEL               29
+#define POWER_LEVEL             30
+#define HIGH_LEVEL              31
+#define CLOCK_LEVEL             CLOCK2_LEVEL
+
+#define KIP0PCRADDRESS          0xffdff000
+#define KI_USER_SHARED_DATA     0xffdf0000
+#define SharedUserData          ((KUSER_SHARED_DATA * CONST)KI_USER_SHARED_DATA)
+
+#define PAGE_SIZE               0x1000
+#define PAGE_SHIFT              12L
+#define KeGetDcacheFillSize()   1L
+
+#define EFLAG_SIGN              0x8000
+#define EFLAG_ZERO              0x4000
+#define EFLAG_SELECT            (EFLAG_SIGN | EFLAG_ZERO)
+
+#define RESULT_NEGATIVE         ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
+#define RESULT_ZERO             ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
+#define RESULT_POSITIVE         ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
+
+
+typedef struct _KFLOATING_SAVE {
+  ULONG ControlWord;
+  ULONG StatusWord;
+  ULONG ErrorOffset;
+  ULONG ErrorSelector;
+  ULONG DataOffset;
+  ULONG DataSelector;
+  ULONG Cr0NpxState;
+  ULONG Spare1;
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+extern NTKERNELAPI volatile KSYSTEM_TIME KeTickCount;
+
+#define YieldProcessor _mm_pause
+
+FORCEINLINE
+VOID
+KeMemoryBarrier(VOID)
+{
+  LONG Barrier, *Dummy = &Barrier;
+  UNREFERENCED_LOCAL_VARIABLE(Dummy);
+
+#if defined(__GNUC__)
+  __asm__ __volatile__ ("xchg %%eax, %0" : : "m" (Barrier) : "%eax");
+#elif defined(_MSC_VER)
+  __asm xchg [Barrier], eax
+#endif
+}
+
+#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
+
+_IRQL_requires_max_(HIGH_LEVEL)
+_IRQL_saves_
+NTHALAPI
+KIRQL
+NTAPI
+KeGetCurrentIrql(VOID);
+
+_IRQL_requires_max_(HIGH_LEVEL)
+NTHALAPI
+VOID
+FASTCALL
+KfLowerIrql(
+  _In_ _IRQL_restores_ _Notliteral_ KIRQL NewIrql);
+#define KeLowerIrql(a) KfLowerIrql(a)
+
+_IRQL_requires_max_(HIGH_LEVEL)
+_IRQL_raises_(NewIrql)
+_IRQL_saves_
+NTHALAPI
+KIRQL
+FASTCALL
+KfRaiseIrql(
+  _In_ KIRQL NewIrql);
+#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
+
+_IRQL_requires_max_(DISPATCH_LEVEL)
+_IRQL_saves_
+_IRQL_raises_(DISPATCH_LEVEL)
+NTHALAPI
+KIRQL
+NTAPI
+KeRaiseIrqlToDpcLevel(VOID);
+
+NTHALAPI
+KIRQL
+NTAPI
+KeRaiseIrqlToSynchLevel(VOID);
+
+_Requires_lock_not_held_(*SpinLock)
+_Acquires_lock_(*SpinLock)
+_IRQL_requires_max_(DISPATCH_LEVEL)
+_IRQL_saves_
+_IRQL_raises_(DISPATCH_LEVEL)
+NTHALAPI
+KIRQL
+FASTCALL
+KfAcquireSpinLock(
+  _Inout_ PKSPIN_LOCK SpinLock);
+#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a)
+
+_Requires_lock_held_(*SpinLock)
+_Releases_lock_(*SpinLock)
+_IRQL_requires_(DISPATCH_LEVEL)
+NTHALAPI
+VOID
+FASTCALL
+KfReleaseSpinLock(
+  _Inout_ PKSPIN_LOCK SpinLock,
+  _In_ _IRQL_restores_ KIRQL NewIrql);
+#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b)
+
+_Requires_lock_not_held_(*SpinLock)
+_Acquires_lock_(*SpinLock)
+_IRQL_requires_min_(DISPATCH_LEVEL)
+NTKERNELAPI
+VOID
+FASTCALL
+KefAcquireSpinLockAtDpcLevel(
+  _Inout_ PKSPIN_LOCK SpinLock);
+#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
+
+_Requires_lock_held_(*SpinLock)
+_Releases_lock_(*SpinLock)
+_IRQL_requires_min_(DISPATCH_LEVEL)
+NTKERNELAPI
+VOID
+FASTCALL
+KefReleaseSpinLockFromDpcLevel(
+  _Inout_ PKSPIN_LOCK SpinLock);
+#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
+
+NTSYSAPI
+PKTHREAD
+NTAPI
+KeGetCurrentThread(VOID);
+
+_Always_(_Post_satisfies_(return<=0))
+_Must_inspect_result_
+_IRQL_requires_max_(DISPATCH_LEVEL)
+_Kernel_float_saved_
+_At_(*FloatSave, _Kernel_requires_resource_not_held_(FloatState) _Kernel_acquires_resource_(FloatState))
+NTKERNELAPI
+NTSTATUS
+NTAPI
+KeSaveFloatingPointState(
+  _Out_ PKFLOATING_SAVE FloatSave);
+
+_Success_(1)
+_Kernel_float_restored_
+_At_(*FloatSave, _Kernel_requires_resource_held_(FloatState) _Kernel_releases_resource_(FloatState))
+NTKERNELAPI
+NTSTATUS
+NTAPI
+KeRestoreFloatingPointState(
+  _In_ PKFLOATING_SAVE FloatSave);
+
+/* VOID
+ * KeFlushIoBuffers(
+ *   IN PMDL Mdl,
+ *   IN BOOLEAN ReadOperation,
+ *   IN BOOLEAN DmaOperation)
+ */
+#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
+
+/* x86 and x64 performs a 0x2C interrupt */
+#define DbgRaiseAssertionFailure __int2c
+
+FORCEINLINE
+VOID
+_KeQueryTickCount(
+  OUT PLARGE_INTEGER CurrentCount)
+{
+  for (;;) {
+#ifdef NONAMELESSUNION
+    CurrentCount->s.HighPart = KeTickCount.High1Time;
+    CurrentCount->s.LowPart = KeTickCount.LowPart;
+    if (CurrentCount->s.HighPart == KeTickCount.High2Time) break;
+#else
+    CurrentCount->HighPart = KeTickCount.High1Time;
+    CurrentCount->LowPart = KeTickCount.LowPart;
+    if (CurrentCount->HighPart == KeTickCount.High2Time) break;
+#endif
+    YieldProcessor();
+  }
+}
+#define KeQueryTickCount(CurrentCount) _KeQueryTickCount(CurrentCount)
+
+
+
+
+
+#elif defined(_M_AMD64)
+/** Kernel definitions for AMD64 **/
+
+/* Interrupt request levels */
+#define PASSIVE_LEVEL           0
+#define LOW_LEVEL               0
+#define APC_LEVEL               1
+#define DISPATCH_LEVEL          2
+#define CMCI_LEVEL              5
+#define CLOCK_LEVEL             13
+#define IPI_LEVEL               14
+#define DRS_LEVEL               14
+#define POWER_LEVEL             14
+#define PROFILE_LEVEL           15
+#define HIGH_LEVEL              15
+
+#define KI_USER_SHARED_DATA     0xFFFFF78000000000ULL
+#define SharedUserData          ((PKUSER_SHARED_DATA const)KI_USER_SHARED_DATA)
+#define SharedInterruptTime     (KI_USER_SHARED_DATA + 0x8)
+#define SharedSystemTime        (KI_USER_SHARED_DATA + 0x14)
+#define SharedTickCount         (KI_USER_SHARED_DATA + 0x320)
+
+#define PAGE_SIZE               0x1000
+#define PAGE_SHIFT              12L
+
+#define EFLAG_SIGN              0x8000
+#define EFLAG_ZERO              0x4000
+#define EFLAG_SELECT            (EFLAG_SIGN | EFLAG_ZERO)
+
+typedef struct _KFLOATING_SAVE {
+  ULONG Dummy;
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
+
+#define KeQueryInterruptTime() \
+    (*(volatile ULONG64*)SharedInterruptTime)
+
+#define KeQuerySystemTime(CurrentCount) \
+    *(ULONG64*)(CurrentCount) = *(volatile ULONG64*)SharedSystemTime
+
+#define KeQueryTickCount(CurrentCount) \
+    *(ULONG64*)(CurrentCount) = *(volatile ULONG64*)SharedTickCount
+
+#define KeGetDcacheFillSize() 1L
+
+#define YieldProcessor _mm_pause
+#define FastFence __faststorefence
+#define LoadFence _mm_lfence
+#define MemoryFence _mm_mfence
+#define StoreFence _mm_sfence
+#define LFENCE_ACQUIRE() LoadFence()
+
+FORCEINLINE
+VOID
+KeMemoryBarrier(VOID)
+{
+  // FIXME: Do we really need lfence after the __faststorefence ?
+  FastFence();
+  LFENCE_ACQUIRE();
+}
+
+#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
+
+FORCEINLINE
+KIRQL
+KeGetCurrentIrql(VOID)
+{
+  return (KIRQL)__readcr8();
+}
+
+FORCEINLINE
+VOID
+KeLowerIrql(IN KIRQL NewIrql)
+{
+  ASSERT((KIRQL)__readcr8() >= NewIrql);
+  __writecr8(NewIrql);
+}
+
+FORCEINLINE
+KIRQL
+KfRaiseIrql(IN KIRQL NewIrql)
+{
+  KIRQL OldIrql;
+
+  OldIrql = (KIRQL)__readcr8();
+  ASSERT(OldIrql <= NewIrql);
+  __writecr8(NewIrql);
+  return OldIrql;
+}
+#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
+
+FORCEINLINE
+KIRQL
+KeRaiseIrqlToDpcLevel(VOID)
+{
+  return KfRaiseIrql(DISPATCH_LEVEL);
+}
+
+FORCEINLINE
+KIRQL
+KeRaiseIrqlToSynchLevel(VOID)
+{
+  return KfRaiseIrql(12); // SYNCH_LEVEL = IPI_LEVEL - 2
+}
+
+FORCEINLINE
+PKTHREAD
+KeGetCurrentThread(VOID)
+{
+  return (struct _KTHREAD *)__readgsqword(0x188);
+}
+
+FORCEINLINE
+NTSTATUS
+KeSaveFloatingPointState(PVOID FloatingState)
+{
+  UNREFERENCED_PARAMETER(FloatingState);
+  return STATUS_SUCCESS;
+}
+
+FORCEINLINE
+NTSTATUS
+KeRestoreFloatingPointState(PVOID FloatingState)
+{
+  UNREFERENCED_PARAMETER(FloatingState);
+  return STATUS_SUCCESS;
+}
+
+/* VOID
+ * KeFlushIoBuffers(
+ *   IN PMDL Mdl,
+ *   IN BOOLEAN ReadOperation,
+ *   IN BOOLEAN DmaOperation)
+ */
+#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
+
+/* x86 and x64 performs a 0x2C interrupt */
+#define DbgRaiseAssertionFailure __int2c
+
+#elif defined(_M_IA64)
+/** Kernel definitions for IA64 **/
+
+/* Interrupt request levels */
+#define PASSIVE_LEVEL           0
+#define LOW_LEVEL               0
+#define APC_LEVEL               1
+#define DISPATCH_LEVEL          2
+#define CMC_LEVEL               3
+#define DEVICE_LEVEL_BASE       4
+#define PC_LEVEL                12
+#define IPI_LEVEL               14
+#define DRS_LEVEL               14
+#define CLOCK_LEVEL             13
+#define POWER_LEVEL             15
+#define PROFILE_LEVEL           15
+#define HIGH_LEVEL              15
+
+#define KI_USER_SHARED_DATA ((ULONG_PTR)(KADDRESS_BASE + 0xFFFE0000))
+extern volatile LARGE_INTEGER KeTickCount;
+
+#define PAUSE_PROCESSOR __yield();
+
+FORCEINLINE
+VOID
+KeFlushWriteBuffer(VOID)
+{
+  __mf ();
+  return;
+}
+
+NTSYSAPI
+PKTHREAD
+NTAPI
+KeGetCurrentThread(VOID);
+
+
+#elif defined(_M_PPC)
+
+/* Interrupt request levels */
+#define PASSIVE_LEVEL                      0
+#define LOW_LEVEL                          0
+#define APC_LEVEL                          1
+#define DISPATCH_LEVEL                     2
+#define PROFILE_LEVEL                     27
+#define CLOCK1_LEVEL                      28
+#define CLOCK2_LEVEL                      28
+#define IPI_LEVEL                         29
+#define POWER_LEVEL                       30
+#define HIGH_LEVEL                        31
+
+//
+// Used to contain PFNs and PFN counts
+//
+typedef ULONG PFN_COUNT;
+typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
+typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
+
+
+typedef struct _KFLOATING_SAVE {
+  ULONG Dummy;
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+typedef struct _KPCR_TIB {
+  PVOID ExceptionList;         /* 00 */
+  PVOID StackBase;             /* 04 */
+  PVOID StackLimit;            /* 08 */
+  PVOID SubSystemTib;          /* 0C */
+  _ANONYMOUS_UNION union {
+    PVOID FiberData;           /* 10 */
+    ULONG Version;             /* 10 */
+  } DUMMYUNIONNAME;
+  PVOID ArbitraryUserPointer;  /* 14 */
+  struct _KPCR_TIB *Self;       /* 18 */
+} KPCR_TIB, *PKPCR_TIB;         /* 1C */
+
+#define PCR_MINOR_VERSION 1
+#define PCR_MAJOR_VERSION 1
+
+typedef struct _KPCR {
+  KPCR_TIB Tib;                /* 00 */
+  struct _KPCR *Self;          /* 1C */
+  struct _KPRCB *Prcb;         /* 20 */
+  KIRQL Irql;                  /* 24 */
+  ULONG IRR;                   /* 28 */
+  ULONG IrrActive;             /* 2C */
+  ULONG IDR;                   /* 30 */
+  PVOID KdVersionBlock;        /* 34 */
+  PUSHORT IDT;                 /* 38 */
+  PUSHORT GDT;                 /* 3C */
+  struct _KTSS *TSS;           /* 40 */
+  USHORT MajorVersion;         /* 44 */
+  USHORT MinorVersion;         /* 46 */
+  KAFFINITY SetMember;         /* 48 */
+  ULONG StallScaleFactor;      /* 4C */
+  UCHAR SpareUnused;           /* 50 */
+  UCHAR Number;                /* 51 */
+} KPCR, *PKPCR;                /* 54 */
+
+#define KeGetPcr()                      PCR
+
+#define YieldProcessor() __asm__ __volatile__("nop");
+
+FORCEINLINE
+ULONG
+NTAPI
+KeGetCurrentProcessorNumber(VOID)
+{
+  ULONG Number;
+  __asm__ __volatile__ (
+    "lwz %0, %c1(12)\n"
+    : "=r" (Number)
+    : "i" (FIELD_OFFSET(KPCR, Number))
+  );
+  return Number;
+}
+
+NTHALAPI
+VOID
+FASTCALL
+KfLowerIrql(
+  IN KIRQL NewIrql);
+#define KeLowerIrql(a) KfLowerIrql(a)
+
+NTHALAPI
+KIRQL
+FASTCALL
+KfRaiseIrql(
+  IN KIRQL NewIrql);
+#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
+
+NTHALAPI
+KIRQL
+NTAPI
+KeRaiseIrqlToDpcLevel(VOID);
+
+NTHALAPI
+KIRQL
+NTAPI
+KeRaiseIrqlToSynchLevel(VOID);
+
+
+
+#elif defined(_M_MIPS)
+#error MIPS Headers are totally incorrect
+
+//
+// Used to contain PFNs and PFN counts
+//
+typedef ULONG PFN_COUNT;
+typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
+typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
+
+#define PASSIVE_LEVEL                      0
+#define APC_LEVEL                          1
+#define DISPATCH_LEVEL                     2
+#define PROFILE_LEVEL                     27
+#define IPI_LEVEL                         29
+#define HIGH_LEVEL                        31
+
+typedef struct _KPCR {
+  struct _KPRCB *Prcb;         /* 20 */
+  KIRQL Irql;                  /* 24 */
+  ULONG IRR;                   /* 28 */
+  ULONG IDR;                   /* 30 */
+} KPCR, *PKPCR;
+
+#define KeGetPcr()                      PCR
+
+typedef struct _KFLOATING_SAVE {
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+static __inline
+ULONG
+NTAPI
+KeGetCurrentProcessorNumber(VOID)
+{
+  return 0;
+}
+
+#define YieldProcessor() __asm__ __volatile__("nop");
+
+#define KeLowerIrql(a) KfLowerIrql(a)
+#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
+
+NTKERNELAPI
+VOID
+NTAPI
+KfLowerIrql(
+  IN KIRQL NewIrql);
+
+NTKERNELAPI
+KIRQL
+NTAPI
+KfRaiseIrql(
+  IN KIRQL NewIrql);
+
+NTKERNELAPI
+KIRQL
+NTAPI
+KeRaiseIrqlToDpcLevel(VOID);
+
+NTKERNELAPI
+KIRQL
+NTAPI
+KeRaiseIrqlToSynchLevel(VOID);
+
+
+#elif defined(_M_ARM)
+#include <armddk.h>
+#else
+#error Unknown Architecture
+#endif
+
 NTKERNELAPI
 VOID
 NTAPI

Modified: trunk/reactos/include/xdk/kefuncs.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/kefuncs.h?rev=55504&r1=55503&r2=55504&view=diff
==============================================================================
--- trunk/reactos/include/xdk/kefuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/kefuncs.h [iso-8859-1] Wed Feb  8 22:15:06 2012
@@ -2,6 +2,22 @@
  *                              Kernel Functions                              *
  ******************************************************************************/
 $if (_WDMDDK_)
+#if defined(_M_IX86)
+$include(x86/ke.h)
+#elif defined(_M_AMD64)
+$include(amd64/ke.h)
+#elif defined(_M_IA64)
+$include(ia64/ke.h)
+#elif defined(_M_PPC)
+$include(ppc/ke.h)
+#elif defined(_M_MIPS)
+$include(mips/ke.h)
+#elif defined(_M_ARM)
+$include(arm/ke.h)
+#else
+#error Unknown Architecture
+#endif
+
 NTKERNELAPI
 VOID
 NTAPI

Modified: trunk/reactos/include/xdk/wdm.template.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/wdm.template.h?rev=55504&r1=55503&r2=55504&view=diff
==============================================================================
--- trunk/reactos/include/xdk/wdm.template.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/wdm.template.h [iso-8859-1] Wed Feb  8 22:15:06 2012
@@ -209,23 +209,6 @@
 $include (interlocked.h)
 $include (rtltypes.h)
 $include (ketypes.h)
-
-#if defined(_M_IX86)
-$include(x86/ke.h)
-#elif defined(_M_AMD64)
-$include(amd64/ke.h)
-#elif defined(_M_IA64)
-$include(ia64/ke.h)
-#elif defined(_M_PPC)
-$include(ppc/ke.h)
-#elif defined(_M_MIPS)
-$include(mips/ke.h)
-#elif defined(_M_ARM)
-$include(arm/ke.h)
-#else
-#error Unknown Architecture
-#endif
-
 $include (mmtypes.h)
 $include (extypes.h)
 $include (setypes.h)




More information about the Ros-diffs mailing list