Author: tkreuzer
Date: Sat Mar 23 21:57:17 2013
New Revision: 58598
URL:
http://svn.reactos.org/svn/reactos?rev=58598&view=rev
Log:
[INCLUDE]
- Add missing __stosq intrinsic
- Move architecture specific stuff to a later location in wdm.h to make sure we have
ASSERT macros already
- Add missing extern "C" to some NDK header
- Remove duplicate sal definitions
Modified:
trunk/reactos/include/crt/msc/intrin.h
trunk/reactos/include/ddk/wdm.h
trunk/reactos/include/ndk/mmtypes.h
trunk/reactos/include/ndk/obfuncs.h
trunk/reactos/include/ndk/rtlfuncs.h
trunk/reactos/include/psdk/sal.h
trunk/reactos/include/psdk/sal_old.h
trunk/reactos/include/xdk/kefuncs.h
trunk/reactos/include/xdk/ketypes.h
Modified: trunk/reactos/include/crt/msc/intrin.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/msc/intrin.h?r…
==============================================================================
--- trunk/reactos/include/crt/msc/intrin.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/msc/intrin.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -117,6 +117,8 @@
#pragma intrinsic(__movsd)
#endif
#ifdef _M_AMD64
+void __stosq(unsigned __int64 * Dest, unsigned __int64 Data, size_t Count);
+#pragma intrinsic(__stosq)
void __movsq(unsigned __int64 * Destination, unsigned __int64 const * Source, size_t
Count);
#pragma intrinsic(__movsq)
#endif
Modified: trunk/reactos/include/ddk/wdm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=5859…
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -1675,567 +1675,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 MemoryBarrier __faststorefence
-#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 *
@@ -10169,6 +9608,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 MemoryBarrier __faststorefence
+#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
Modified: trunk/reactos/include/ndk/mmtypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/mmtypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/mmtypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/mmtypes.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -66,12 +66,12 @@
//
// Flags for ProcessExecutionOptions
//
-#define MEM_EXECUTE_OPTION_DISABLE 0x1
+#define MEM_EXECUTE_OPTION_DISABLE 0x1
#define MEM_EXECUTE_OPTION_ENABLE 0x2
#define MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION 0x4
#define MEM_EXECUTE_OPTION_PERMANENT 0x8
#define MEM_EXECUTE_OPTION_EXECUTE_DISPATCH_ENABLE 0x10
-#define MEM_EXECUTE_OPTION_IMAGE_DISPATCH_ENABLE 0x20
+#define MEM_EXECUTE_OPTION_IMAGE_DISPATCH_ENABLE 0x20
#define MEM_EXECUTE_OPTION_VALID_FLAGS 0x3F
#ifndef NTOS_MODE_USER
@@ -989,6 +989,10 @@
ULONG NumberOfThunks;
} DRIVER_SPECIFIED_VERIFIER_THUNKS, *PDRIVER_SPECIFIED_VERIFIER_THUNKS;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
//
// Default heap size values. For user mode, these values are copied to a new
// process's PEB by the kernel in MmCreatePeb. In kernel mode, RtlCreateHeap
@@ -1007,6 +1011,10 @@
//
extern POBJECT_TYPE NTSYSAPI MmSectionObjectType;
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
#endif // !NTOS_MODE_USER
#endif // _MMTYPES_H
Modified: trunk/reactos/include/ndk/obfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/obfuncs.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/obfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/obfuncs.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -25,6 +25,10 @@
#include <umtypes.h>
#include <pstypes.h>
#include <obtypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
#ifndef NTOS_MODE_USER
@@ -576,4 +580,8 @@
#endif /* NTOS_MODE_USER */
+#ifdef __cplusplus
+}; // extern "C"
#endif
+
+#endif
Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -3259,6 +3259,7 @@
_In_ ULONG MaximumResponseLength
);
+#undef DbgBreakPoint
VOID
NTAPI
DbgBreakPoint(
Modified: trunk/reactos/include/psdk/sal.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/sal.h?rev=585…
==============================================================================
--- trunk/reactos/include/psdk/sal.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/sal.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -1090,7 +1090,6 @@
#define _In_function_class_(x) _In_function_class_(#x)
#define _Called_from_function_class_(x) _In_function_class_(x)
-#define _Function_class_(x) _SA_annotes1(SAL_functionClassNew, #x)
#else // ] [ !_PREFAST_
Modified: trunk/reactos/include/psdk/sal_old.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/sal_old.h?rev…
==============================================================================
--- trunk/reactos/include/psdk/sal_old.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/sal_old.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -53,7 +53,6 @@
#define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {}
#define __inner_override __declspec("__override")
#define __inner_success(expr)
__declspec("SAL_success("SPECSTRINGIZE(expr)")")
-#define __inner_typefix(ctype)
__declspec("SAL_typefix("SPECSTRINGIZE(ctype)")")
#define __maybenull __declspec("SAL_maybenull")
#define __maybereadonly __declspec("SAL_maybereadonly")
#define __maybevalid __declspec("SAL_maybevalid")
Modified: trunk/reactos/include/xdk/kefuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/kefuncs.h?rev=…
==============================================================================
--- trunk/reactos/include/xdk/kefuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/kefuncs.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -2,6 +2,21 @@
* 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
Modified: trunk/reactos/include/xdk/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/ketypes.h?rev=…
==============================================================================
--- trunk/reactos/include/xdk/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/ketypes.h [iso-8859-1] Sat Mar 23 21:57:17 2013
@@ -1237,21 +1237,3 @@
$endif (_NTIFS_)
-$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
-$endif (_WDMDDK_)
-