Author: tkreuzer
Date: Sun May 10 19:34:38 2015
New Revision: 67631
URL:
http://svn.reactos.org/svn/reactos?rev=67631&view=rev
Log:
[XDK/DDK/NDK/PSDK/ARMDDK]
- Move stuff from armddk.h to XDK/DDK
- Fix ARM CONTEXT flags
- Add missing KeGetCurrentIrql() for ARM
- Improve some amd64 based definitions
- Use Native math for Int64Sh**Mod32 on ARM
Modified:
trunk/reactos/include/ddk/ntddk.h
trunk/reactos/include/ddk/wdm.h
trunk/reactos/include/ndk/inline_ntcurrentteb.h
trunk/reactos/include/ndk/psfuncs.h
trunk/reactos/include/psdk/ntdef.h
trunk/reactos/include/psdk/winnt.h
trunk/reactos/include/reactos/arm/armddk.h
trunk/reactos/include/xdk/amd64/ke.h
trunk/reactos/include/xdk/amd64/mm.h
trunk/reactos/include/xdk/arm/ke.h
trunk/reactos/include/xdk/ketypes.h
trunk/reactos/include/xdk/ntbasedef.h
trunk/reactos/include/xdk/ntddk.template.h
trunk/reactos/include/xdk/winnt_old.h
trunk/reactos/ntoskrnl/include/internal/arm/ke.h
trunk/reactos/ntoskrnl/include/internal/arm/mm.h
Modified: trunk/reactos/include/ddk/ntddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntddk.h?rev=67…
==============================================================================
--- trunk/reactos/include/ddk/ntddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/ntddk.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -2023,10 +2023,10 @@
#define XSTATE_LEGACY_SSE 1
#define XSTATE_GSSE 2
-#define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 <<
(XSTATE_LEGACY_FLOATING_POINT))
-#define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE))
+#define XSTATE_MASK_LEGACY_FLOATING_POINT (1LL <<
(XSTATE_LEGACY_FLOATING_POINT))
+#define XSTATE_MASK_LEGACY_SSE (1LL << (XSTATE_LEGACY_SSE))
#define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT |
XSTATE_MASK_LEGACY_SSE)
-#define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE))
+#define XSTATE_MASK_GSSE (1LL << (XSTATE_GSSE))
#define MAXIMUM_XSTATE_FEATURES 64
@@ -3327,13 +3327,17 @@
extern NTKERNELAPI PVOID MmSystemRangeStart;
extern NTKERNELAPI ULONG64 MmUserProbeAddress;
-#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
-#define MM_SYSTEM_RANGE_START MmSystemRangeStart
-#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
-#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
+#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
+#define MM_SYSTEM_RANGE_START MmSystemRangeStart
+#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_)
+#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_
+extern ULONG64 _LOCAL_COPY_USER_PROBE_ADDRESS_;
+#else
+#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
+#endif
+#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000ULL
-
#elif defined(_M_IA64)
#elif defined(_M_PPC)
@@ -3343,7 +3347,184 @@
#elif defined(_M_ARM)
-#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
+#define PAUSE_PROCESSOR __yield();
+
+#define KERNEL_STACK_SIZE 0x3000
+#define KERNEL_LARGE_STACK_SIZE 0xF000
+#define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
+
+#define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000
+
+#define EXCEPTION_READ_FAULT 0
+#define EXCEPTION_WRITE_FAULT 1
+#define EXCEPTION_EXECUTE_FAULT 8
+
+/* The following flags control the contents of the CONTEXT structure. */
+#define CONTEXT_ARM 0x200000L
+#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
+#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
+#define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008L)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |
CONTEXT_FLOATING_POINT)
+
+typedef struct _NEON128
+{
+ ULONGLONG Low;
+ LONGLONG High;
+} NEON128, *PNEON128;
+
+#define ARM_MAX_BREAKPOINTS 8
+#define ARM_MAX_WATCHPOINTS 1
+
+typedef struct _CONTEXT
+{
+ /* The flags values within this flag control the contents of
+ a CONTEXT record.
+
+ If the context record is used as an input parameter, then
+ for each portion of the context record controlled by a flag
+ whose value is set, it is assumed that that portion of the
+ context record contains valid context. If the context record
+ is being used to modify a thread's context, then only that
+ portion of the threads context will be modified.
+
+ If the context record is used as an IN OUT parameter to capture
+ the context of a thread, then only those portions of the thread's
+ context corresponding to set flags will be returned.
+
+ The context record is never used as an OUT only parameter. */
+ ULONG ContextFlags;
+
+ /* This section is specified/returned if the ContextFlags word contains
+ the flag CONTEXT_INTEGER. */
+ ULONG R0;
+ ULONG R1;
+ ULONG R2;
+ ULONG R3;
+ ULONG R4;
+ ULONG R5;
+ ULONG R6;
+ ULONG R7;
+ ULONG R8;
+ ULONG R9;
+ ULONG R10;
+ ULONG R11;
+ ULONG R12;
+
+ ULONG Sp;
+ ULONG Lr;
+ ULONG Pc;
+ ULONG Cpsr;
+
+ /* Floating Point/NEON Registers */
+ ULONG Fpscr;
+ ULONG Padding;
+ union
+ {
+ NEON128 Q[16];
+ ULONGLONG D[32];
+ ULONG S[32];
+ } DUMMYUNIONNAME;
+
+ /* Debug registers */
+ ULONG Bvr[ARM_MAX_BREAKPOINTS];
+ ULONG Bcr[ARM_MAX_BREAKPOINTS];
+ ULONG Wvr[ARM_MAX_WATCHPOINTS];
+ ULONG Wcr[ARM_MAX_WATCHPOINTS];
+
+ ULONG Padding2[2];
+} CONTEXT;
+
+#define PCR_MINOR_VERSION 1
+#define PCR_MAJOR_VERSION 1
+
+typedef struct _KPCR
+{
+ _ANONYMOUS_UNION union
+ {
+ NT_TIB NtTib;
+ _ANONYMOUS_STRUCT struct
+ {
+ ULONG TibPad0[2];
+ PVOID Spare1;
+ struct _KPCR *Self;
+ struct _KPRCB *CurrentPrcb;
+ PKSPIN_LOCK_QUEUE LockArray;
+ PVOID Used_Self;
+ };
+ };
+ KIRQL CurrentIrql;
+ UCHAR SecondLevelCacheAssociativity;
+ ULONG Unused0[3];
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+ ULONG StallScaleFactor;
+ PVOID Unused1[3];
+ ULONG KernelReserved[15];
+ ULONG SecondLevelCacheSize;
+ _ANONYMOUS_UNION union
+ {
+ USHORT SoftwareInterruptPending; // Software Interrupt Pending Flag
+ struct
+ {
+ UCHAR ApcInterrupt; // 0x01 if APC int pending
+ UCHAR DispatchInterrupt; // 0x01 if dispatch int pending
+ };
+ };
+ USHORT InterruptPad;
+ ULONG HalReserved[32];
+ PVOID KdVersionBlock;
+ PVOID Unused3;
+ ULONG PcrAlign1[8];
+} KPCR, *PKPCR;
+
+#define CP15_PCR_RESERVED_MASK 0xFFF
+//#define KIPCR() ((ULONG_PTR)(_MoveFromCoprocessor(CP15_TPIDRPRW)) &
~CP15_PCR_RESERVED_MASK)
+
+FORCEINLINE
+PKPCR
+KeGetPcr(
+ VOID)
+{
+ return (PKPCR)(_MoveFromCoprocessor(CP15_TPIDRPRW) & ~CP15_PCR_RESERVED_MASK);
+}
+
+#if (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS)
+FORCEINLINE
+ULONG
+KeGetCurrentProcessorNumber(
+ VOID)
+
+{
+ return *((PUCHAR)KeGetPcr() + 0x580);
+}
+#endif /* (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS) */
+
+
+#define PTI_SHIFT 12
+#define PDI_SHIFT 22
+
+#define PDE_BASE 0xC0300000
+#define PTE_BASE 0xC0000000
+#define PDE_TOP 0xC0300FFF
+#define PTE_TOP 0xC03FFFFF
+
+extern NTKERNELAPI PVOID MmHighestUserAddress;
+extern NTKERNELAPI PVOID MmSystemRangeStart;
+extern NTKERNELAPI ULONG MmUserProbeAddress;
+
+#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
+#define MM_SYSTEM_RANGE_START MmSystemRangeStart
+#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_)
+#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_
+extern ULONG _LOCAL_COPY_USER_PROBE_ADDRESS_;
+#else
+#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
+#endif
+#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
+#define MM_KSEG0_BASE MM_SYSTEM_RANGE_START
+#define MM_SYSTEM_SPACE_END 0xFFFFFFFF
+
#else
#error Unknown Architecture
#endif
Modified: trunk/reactos/include/ddk/wdm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=6763…
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -8623,7 +8623,7 @@
#define HIGH_LEVEL 15
#define KI_USER_SHARED_DATA 0xFFFFF78000000000ULL
-#define SharedUserData ((PKUSER_SHARED_DATA const)KI_USER_SHARED_DATA)
+#define SharedUserData ((KUSER_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)
@@ -8635,8 +8635,9 @@
#define EFLAG_ZERO 0x4000
#define EFLAG_SELECT (EFLAG_SIGN | EFLAG_ZERO)
-typedef struct _KFLOATING_SAVE {
- ULONG Dummy;
+typedef struct _KFLOATING_SAVE
+{
+ ULONG Dummy;
} KFLOATING_SAVE, *PKFLOATING_SAVE;
typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
@@ -8662,78 +8663,101 @@
FORCEINLINE
VOID
-KeMemoryBarrier(VOID)
+KeMemoryBarrier(
+ VOID)
{
- // FIXME: Do we really need lfence after the __faststorefence ?
- FastFence();
- LFENCE_ACQUIRE();
+ // FIXME: Do we really need lfence after the __faststorefence ?
+ FastFence();
+ LFENCE_ACQUIRE();
}
#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
+_IRQL_requires_max_(HIGH_LEVEL)
+_IRQL_saves_
FORCEINLINE
KIRQL
KeGetCurrentIrql(VOID)
{
- return (KIRQL)__readcr8();
+ return (KIRQL)__readcr8();
}
+_IRQL_requires_max_(HIGH_LEVEL)
FORCEINLINE
VOID
-KeLowerIrql(IN KIRQL NewIrql)
+KeLowerIrql(
+ _In_ _IRQL_restores_ _Notliteral_ KIRQL NewIrql)
{
- //ASSERT((KIRQL)__readcr8() >= NewIrql);
- __writecr8(NewIrql);
+ //ASSERT((KIRQL)__readcr8() >= NewIrql);
+ __writecr8(NewIrql);
}
+_IRQL_requires_max_(HIGH_LEVEL)
+_IRQL_raises_(NewIrql)
+_IRQL_saves_
FORCEINLINE
KIRQL
-KfRaiseIrql(IN KIRQL NewIrql)
+KfRaiseIrql(
+ _In_ KIRQL NewIrql)
{
- KIRQL OldIrql;
-
- OldIrql = (KIRQL)__readcr8();
- //ASSERT(OldIrql <= NewIrql);
- __writecr8(NewIrql);
- return OldIrql;
+ KIRQL OldIrql;
+
+ OldIrql = (KIRQL)__readcr8();
+ //ASSERT(OldIrql <= NewIrql);
+ __writecr8(NewIrql);
+ return OldIrql;
}
#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
+_IRQL_requires_max_(DISPATCH_LEVEL)
+_IRQL_saves_
+_IRQL_raises_(DISPATCH_LEVEL)
FORCEINLINE
KIRQL
-KeRaiseIrqlToDpcLevel(VOID)
+KeRaiseIrqlToDpcLevel(
+ VOID)
{
- return KfRaiseIrql(DISPATCH_LEVEL);
+ return KfRaiseIrql(DISPATCH_LEVEL);
}
FORCEINLINE
KIRQL
KeRaiseIrqlToSynchLevel(VOID)
{
- return KfRaiseIrql(12); // SYNCH_LEVEL = IPI_LEVEL - 2
+ return KfRaiseIrql(12); // SYNCH_LEVEL = IPI_LEVEL - 2
}
FORCEINLINE
PKTHREAD
KeGetCurrentThread(VOID)
{
- return (struct _KTHREAD *)__readgsqword(0x188);
+ return (struct _KTHREAD *)__readgsqword(0x188);
}
+_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))
FORCEINLINE
NTSTATUS
-KeSaveFloatingPointState(PVOID FloatingState)
+KeSaveFloatingPointState(
+ _Out_ PKFLOATING_SAVE FloatSave)
{
- UNREFERENCED_PARAMETER(FloatingState);
- return STATUS_SUCCESS;
+ UNREFERENCED_PARAMETER(FloatSave);
+ return STATUS_SUCCESS;
}
+_Success_(1)
+_Kernel_float_restored_
+_At_(*FloatSave, _Kernel_requires_resource_held_(FloatState)
_Kernel_releases_resource_(FloatState))
FORCEINLINE
NTSTATUS
-KeRestoreFloatingPointState(PVOID FloatingState)
+KeRestoreFloatingPointState(
+ _In_ PKFLOATING_SAVE FloatSave)
{
- UNREFERENCED_PARAMETER(FloatingState);
- return STATUS_SUCCESS;
+ UNREFERENCED_PARAMETER(FloatSave);
+ return STATUS_SUCCESS;
}
/* VOID
@@ -8956,9 +8980,206 @@
#elif defined(_M_ARM)
-#include <armddk.h>
+/** Kernel definitions for ARM **/
+
+/* Interrupt request levels */
+#define PASSIVE_LEVEL 0
+#define LOW_LEVEL 0
+#define APC_LEVEL 1
+#define DISPATCH_LEVEL 2
+#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 KIP0PCRADDRESS 0xFFDFF000
+#define KI_USER_SHARED_DATA 0xFFFF9000
+#define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA)
+
+#define PAGE_SIZE 0x1000
+#define PAGE_SHIFT 12L
+
+typedef struct _KFLOATING_SAVE
+{
+ ULONG Reserved;
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+extern NTKERNELAPI volatile KSYSTEM_TIME KeTickCount;
+
+FORCEINLINE
+VOID
+YieldProcessor(
+ VOID)
+{
+ __dmb(_ARM_BARRIER_ISHST);
+ __yield();
+}
+
+#define MemoryBarrier() __dmb(_ARM_BARRIER_SY)
+#define PreFetchCacheLine(l,a) __prefetch((const void *) (a))
+#define PrefetchForWrite(p) __prefetch((const void *) (p))
+#define ReadForWriteAccess(p) (*(p))
+
+FORCEINLINE
+VOID
+KeMemoryBarrier(
+ VOID)
+{
+ _ReadWriteBarrier();
+ MemoryBarrier();
+}
#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))
+FORCEINLINE
+NTSTATUS
+KeSaveFloatingPointState(
+ _Out_ PKFLOATING_SAVE FloatSave)
+{
+ UNREFERENCED_PARAMETER(FloatSave);
+ return STATUS_SUCCESS;
+}
+
+_Success_(1)
+_Kernel_float_restored_
+_At_(*FloatSave, _Kernel_requires_resource_held_(FloatState)
_Kernel_releases_resource_(FloatState))
+FORCEINLINE
+NTSTATUS
+KeRestoreFloatingPointState(
+ _In_ PKFLOATING_SAVE FloatSave)
+{
+ UNREFERENCED_PARAMETER(FloatSave);
+ return STATUS_SUCCESS;
+}
+
+VOID
+KeFlushIoBuffers(
+ _In_ PMDL Mdl,
+ _In_ BOOLEAN ReadOperation,
+ _In_ BOOLEAN DmaOperation);
+
+#define DbgRaiseAssertionFailure() __emit(0xdefc)
+
+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)
+
+#define CP15_PMSELR 15, 0, 9, 12, 5 /* Event Counter Selection Register */
+#define CP15_PMXEVCNTR 15, 0, 9, 13, 2 /* Event Count Register */
+#define CP15_TPIDRURW 15, 0, 13, 0, 2 /* Software Thread ID Register, UsRW */
+#define CP15_TPIDRURO 15, 0, 13, 0, 3 /* Software Thread ID Register, UsRO */
+#define CP15_TPIDRPRW 15, 0, 13, 0, 4 /* Software Thread ID Register, Kernel */
+
#else
#error Unknown Architecture
#endif
Modified: trunk/reactos/include/ndk/inline_ntcurrentteb.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/inline_ntcurre…
==============================================================================
--- trunk/reactos/include/ndk/inline_ntcurrentteb.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/inline_ntcurrentteb.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -7,12 +7,11 @@
return (struct _TEB *)__readfsdword(0x18);
}
#elif defined(_M_ARM)
-
-//
-// NT-ARM is not documented
-//
-#include <armddk.h>
-
+FORCEINLINE struct _TEB * NtCurrentTeb(void)
+{
+ __debugbreak();
+ return (struct _TEB *)0;
+}
#elif defined(_M_AMD64)
FORCEINLINE struct _TEB * NtCurrentTeb(void)
{
Modified: trunk/reactos/include/ndk/psfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/psfuncs.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/psfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/psfuncs.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -410,7 +410,6 @@
_In_ BOOLEAN CreateSuspended
);
-#ifndef _M_ARM
#ifndef NTOS_MODE_USER
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
{
@@ -418,11 +417,12 @@
return (PTEB)__readfsdword(0x18);
#elif defined (_M_AMD64)
return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
+#elif defined (_M_ARM)
+ return (struct _TEB *)KeGetPcr()->Used_Self;
#endif
}
#else
struct _TEB * NtCurrentTeb(void);
-#endif
#endif
NTSYSCALLAPI
Modified: trunk/reactos/include/psdk/ntdef.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntdef.h?rev=6…
==============================================================================
--- trunk/reactos/include/psdk/ntdef.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/ntdef.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -838,7 +838,7 @@
#define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned
__int64)(unsigned int)(b))
#endif
-#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE)
+#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE) || defined(_M_ARM)
/* Use native math */
#define Int64ShllMod32(a,b) ((unsigned __int64)(a)<<(b))
#define Int64ShraMod32(a,b) (((__int64)(a))>>(b))
Modified: trunk/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=6…
==============================================================================
--- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -772,7 +772,7 @@
#define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned
__int64)(unsigned int)(b))
#endif
-#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE)
+#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE) || defined(_M_ARM)
/* Use native math */
#define Int64ShllMod32(a,b) ((unsigned __int64)(a)<<(b))
#define Int64ShraMod32(a,b) (((__int64)(a))>>(b))
@@ -4307,13 +4307,19 @@
/* The following flags control the contents of the CONTEXT structure. */
-#define CONTEXT_ARM 0x0000040
+#define CONTEXT_ARM 0x200000L
#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
-
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
-
-typedef struct _NEON128 {
+#define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008L)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |
CONTEXT_FLOATING_POINT)
+
+#define EXCEPTION_READ_FAULT 0
+#define EXCEPTION_WRITE_FAULT 1
+#define EXCEPTION_EXECUTE_FAULT 8
+
+typedef struct _NEON128
+{
ULONGLONG Low;
LONGLONG High;
} NEON128, *PNEON128;
@@ -4321,7 +4327,8 @@
#define ARM_MAX_BREAKPOINTS 8
#define ARM_MAX_WATCHPOINTS 1
-typedef struct _CONTEXT {
+typedef struct _CONTEXT
+{
/* The flags values within this flag control the contents of
a CONTEXT record.
@@ -4337,7 +4344,6 @@
context corresponding to set flags will be returned.
The context record is never used as an OUT only parameter. */
-
DWORD ContextFlags;
/* This section is specified/returned if the ContextFlags word contains
@@ -4364,7 +4370,8 @@
/* Floating Point/NEON Registers */
DWORD Fpscr;
DWORD Padding;
- union {
+ union
+ {
NEON128 Q[16];
ULONGLONG D[32];
DWORD S[32];
Modified: trunk/reactos/include/reactos/arm/armddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arm/armddk…
==============================================================================
--- trunk/reactos/include/reactos/arm/armddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/arm/armddk.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -1,41 +1,12 @@
#ifndef _ARMDDK_
#define _ARMDDK_
-//
-// Page size
-//
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 0x1000
-#endif
+#define USPCR 0x7FFF0000
+#define USERPCR ((volatile KPCR * const)USPCR)
+
#ifndef _WINNT_
-//
-// IRQLs
-//
-#define PASSIVE_LEVEL 0
-#define LOW_LEVEL 0
-#define APC_LEVEL 1
-#define DISPATCH_LEVEL 2
-#define SYNCH_LEVEL DISPATCH_LEVEL
-#define PROFILE_LEVEL 27
-#define CLOCK1_LEVEL 28
-#define CLOCK2_LEVEL 28
-#define IPI_LEVEL 29
-#define POWER_LEVEL 30
-#define HIGH_LEVEL 31
-#endif
-//
-// FIXME: mmtypes.h?
-//
-#define KIP0PCRADDRESS 0xFFDFF000
-#define KI_USER_SHARED_DATA 0xFFFF9000
-#define USPCR 0x7FFF0000
-#define PCR ((KPCR * const)KIP0PCRADDRESS)
-#define USERPCR ((volatile KPCR * const)USPCR)
-#define KeGetPcr() PCR
-#ifndef _WINNT_
-#define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA)
//
// Address space layout
@@ -49,14 +20,7 @@
#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
-//
-// Maximum IRQs
-//
-#define MAXIMUM_VECTOR 16
-#define KERNEL_STACK_SIZE 12288
-#define KERNEL_LARGE_STACK_SIZE 61440
-#define KERNEL_LARGE_STACK_COMMIT 12288
//
// Used to contain PFNs and PFN counts
@@ -65,86 +29,7 @@
//typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
//typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
-//
-// Stub
-//
-typedef struct _KFLOATING_SAVE
-{
- ULONG Reserved;
-} KFLOATING_SAVE, *PKFLOATING_SAVE;
-/* The following flags control the contents of the CONTEXT structure. */
-#define CONTEXT_ARM 0x0000040
-#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
-#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
-
-
-typedef struct _NEON128 {
- ULONGLONG Low;
- LONGLONG High;
-} NEON128, *PNEON128;
-
-#define ARM_MAX_BREAKPOINTS 8
-#define ARM_MAX_WATCHPOINTS 1
-
-typedef struct _CONTEXT {
- /* The flags values within this flag control the contents of
- a CONTEXT record.
-
- If the context record is used as an input parameter, then
- for each portion of the context record controlled by a flag
- whose value is set, it is assumed that that portion of the
- context record contains valid context. If the context record
- is being used to modify a thread's context, then only that
- portion of the threads context will be modified.
-
- If the context record is used as an IN OUT parameter to capture
- the context of a thread, then only those portions of the thread's
- context corresponding to set flags will be returned.
-
- The context record is never used as an OUT only parameter. */
-
- ULONG ContextFlags;
-
- /* This section is specified/returned if the ContextFlags word contains
- the flag CONTEXT_INTEGER. */
- ULONG R0;
- ULONG R1;
- ULONG R2;
- ULONG R3;
- ULONG R4;
- ULONG R5;
- ULONG R6;
- ULONG R7;
- ULONG R8;
- ULONG R9;
- ULONG R10;
- ULONG R11;
- ULONG R12;
-
- ULONG Sp;
- ULONG Lr;
- ULONG Pc;
- ULONG Cpsr;
-
- /* Floating Point/NEON Registers */
- ULONG Fpscr;
- ULONG Padding;
- union {
- NEON128 Q[16];
- ULONGLONG D[32];
- ULONG S[32];
- } DUMMYUNIONNAME;
-
- /* Debug registers */
- ULONG Bvr[ARM_MAX_BREAKPOINTS];
- ULONG Bcr[ARM_MAX_BREAKPOINTS];
- ULONG Wvr[ARM_MAX_WATCHPOINTS];
- ULONG Wcr[ARM_MAX_WATCHPOINTS];
-
- ULONG Padding2[2];
-} CONTEXT;
#endif
@@ -155,210 +40,11 @@
#define KIRQL ULONG
#endif
-typedef struct _NT_TIB_KPCR {
- struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
- PVOID StackBase;
- PVOID StackLimit;
- PVOID SubSystemTib;
- _ANONYMOUS_UNION union {
- PVOID FiberData;
- ULONG Version;
- } DUMMYUNIONNAME;
- PVOID ArbitraryUserPointer;
- struct _NT_TIB_KPCR *Self;
-} NT_TIB_KPCR,*PNT_TIB_KPCR;
-
-typedef struct _KPCR
-{
- union
- {
- NT_TIB_KPCR NtTib;
- struct
- {
- struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList; // Unused
- PVOID Used_StackBase; // Unused
- PVOID PerfGlobalGroupMask;
- PVOID TssCopy; // Unused
- ULONG ContextSwitches;
- KAFFINITY SetMemberCopy; // Unused
- PVOID Used_Self;
- };
- };
- struct _KPCR *Self;
- struct _KPRCB *Prcb;
- KIRQL Irql;
- ULONG IRR; // Unused
- ULONG IrrActive; // Unused
- ULONG IDR; // Unused
- PVOID KdVersionBlock;
- PVOID IDT; // Unused
- PVOID GDT; // Unused
- PVOID TSS; // Unused
- USHORT MajorVersion;
- USHORT MinorVersion;
- KAFFINITY SetMember;
- ULONG StallScaleFactor;
- UCHAR SpareUnused;
- UCHAR Number;
- UCHAR Spare0;
- UCHAR SecondLevelCacheAssociativity;
- ULONG VdmAlert;
- ULONG KernelReserved[14];
- ULONG SecondLevelCacheSize;
- ULONG HalReserved[16];
-} KPCR, *PKPCR;
-
-//
-// Get the current TEB
-//
-FORCEINLINE
-struct _TEB* NtCurrentTeb(VOID)
-{
- return (struct _TEB*)USERPCR->Used_Self;
-}
-
-NTSYSAPI
-struct _KTHREAD*
-NTAPI
-KeGetCurrentThread(VOID);
-
-FORCEINLINE
-NTSTATUS
-KeSaveFloatingPointState(PVOID FloatingState)
-{
- UNREFERENCED_PARAMETER(FloatingState);
- return STATUS_SUCCESS;
-}
-
-FORCEINLINE
-NTSTATUS
-KeRestoreFloatingPointState(PVOID FloatingState)
-{
- UNREFERENCED_PARAMETER(FloatingState);
- return STATUS_SUCCESS;
-}
-
-extern volatile struct _KSYSTEM_TIME KeTickCount;
-
-#ifndef YieldProcessor
-#define YieldProcessor __yield
-#endif
-
#define ASSERT_BREAKPOINT BREAKPOINT_COMMAND_STRING + 1
-
-#define DbgRaiseAssertionFailure() __emit(0xdefc)
-
-#define PCR_MINOR_VERSION 1
-#define PCR_MAJOR_VERSION 1
#define RESULT_ZERO 0
#define RESULT_NEGATIVE 1
#define RESULT_POSITIVE 2
-
-#if 0
-DECLSPEC_IMPORT
-VOID
-__fastcall
-KfReleaseSpinLock(
- IN OUT ULONG_PTR* SpinLock,
- IN KIRQL NewIrql);
-
-DECLSPEC_IMPORT
-KIRQL
-__fastcall
-KfAcquireSpinLock(
- IN OUT ULONG_PTR* SpinLock);
-#endif
-
-#ifndef _WINNT_
-//
-// IRQL Support on ARM is similar to MIPS/ALPHA
-//
-KIRQL
-KfRaiseIrql(
- IN KIRQL NewIrql
-);
-
-VOID
-KfLowerIrql(
- IN KIRQL NewIrql
-);
-
-KIRQL
-KeRaiseIrqlToSynchLevel(
- VOID
-);
-
-KIRQL
-KeRaiseIrqlToDpcLevel(
- VOID
-);
-
-#define KeLowerIrql(NewIrql) KfLowerIrql(NewIrql)
-#define KeRaiseIrql(NewIrql, OldIrql) *(OldIrql) = KfRaiseIrql(NewIrql)
-
-NTHALAPI
-KIRQL
-FASTCALL
-KfAcquireSpinLock(
- IN OUT PKSPIN_LOCK SpinLock);
-#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a)
-
-NTHALAPI
-VOID
-FASTCALL
-KfReleaseSpinLock(
- IN OUT PKSPIN_LOCK SpinLock,
- IN KIRQL NewIrql);
-#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b)
-
-NTKERNELAPI
-VOID
-FASTCALL
-KefAcquireSpinLockAtDpcLevel(
- IN OUT PKSPIN_LOCK SpinLock);
-#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
-
-NTKERNELAPI
-VOID
-FASTCALL
-KefReleaseSpinLockFromDpcLevel(
- IN OUT PKSPIN_LOCK SpinLock);
-#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
-
-//
-// Cache clean and flush
-//
-VOID
-HalSweepDcache(
- VOID
-);
-
-VOID
-HalSweepIcache(
- VOID
-);
-
-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)
-#endif
//
// Intrinsics
Modified: trunk/reactos/include/xdk/amd64/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/amd64/ke.h?rev…
==============================================================================
--- trunk/reactos/include/xdk/amd64/ke.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/amd64/ke.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -15,7 +15,7 @@
#define HIGH_LEVEL 15
#define KI_USER_SHARED_DATA 0xFFFFF78000000000ULL
-#define SharedUserData ((PKUSER_SHARED_DATA const)KI_USER_SHARED_DATA)
+#define SharedUserData ((KUSER_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)
@@ -27,8 +27,9 @@
#define EFLAG_ZERO 0x4000
#define EFLAG_SELECT (EFLAG_SIGN | EFLAG_ZERO)
-typedef struct _KFLOATING_SAVE {
- ULONG Dummy;
+typedef struct _KFLOATING_SAVE
+{
+ ULONG Dummy;
} KFLOATING_SAVE, *PKFLOATING_SAVE;
typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
@@ -54,78 +55,101 @@
FORCEINLINE
VOID
-KeMemoryBarrier(VOID)
-{
- // FIXME: Do we really need lfence after the __faststorefence ?
- FastFence();
- LFENCE_ACQUIRE();
+KeMemoryBarrier(
+ VOID)
+{
+ // FIXME: Do we really need lfence after the __faststorefence ?
+ FastFence();
+ LFENCE_ACQUIRE();
}
#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
+_IRQL_requires_max_(HIGH_LEVEL)
+_IRQL_saves_
FORCEINLINE
KIRQL
KeGetCurrentIrql(VOID)
{
- return (KIRQL)__readcr8();
-}
-
+ return (KIRQL)__readcr8();
+}
+
+_IRQL_requires_max_(HIGH_LEVEL)
FORCEINLINE
VOID
-KeLowerIrql(IN KIRQL NewIrql)
-{
- //ASSERT((KIRQL)__readcr8() >= NewIrql);
- __writecr8(NewIrql);
-}
-
+KeLowerIrql(
+ _In_ _IRQL_restores_ _Notliteral_ KIRQL NewIrql)
+{
+ //ASSERT((KIRQL)__readcr8() >= NewIrql);
+ __writecr8(NewIrql);
+}
+
+_IRQL_requires_max_(HIGH_LEVEL)
+_IRQL_raises_(NewIrql)
+_IRQL_saves_
FORCEINLINE
KIRQL
-KfRaiseIrql(IN KIRQL NewIrql)
-{
- KIRQL OldIrql;
-
- OldIrql = (KIRQL)__readcr8();
- //ASSERT(OldIrql <= NewIrql);
- __writecr8(NewIrql);
- return OldIrql;
+KfRaiseIrql(
+ _In_ KIRQL NewIrql)
+{
+ KIRQL OldIrql;
+
+ OldIrql = (KIRQL)__readcr8();
+ //ASSERT(OldIrql <= NewIrql);
+ __writecr8(NewIrql);
+ return OldIrql;
}
#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
+_IRQL_requires_max_(DISPATCH_LEVEL)
+_IRQL_saves_
+_IRQL_raises_(DISPATCH_LEVEL)
FORCEINLINE
KIRQL
-KeRaiseIrqlToDpcLevel(VOID)
-{
- return KfRaiseIrql(DISPATCH_LEVEL);
+KeRaiseIrqlToDpcLevel(
+ VOID)
+{
+ return KfRaiseIrql(DISPATCH_LEVEL);
}
FORCEINLINE
KIRQL
KeRaiseIrqlToSynchLevel(VOID)
{
- return KfRaiseIrql(12); // SYNCH_LEVEL = IPI_LEVEL - 2
+ return KfRaiseIrql(12); // SYNCH_LEVEL = IPI_LEVEL - 2
}
FORCEINLINE
PKTHREAD
KeGetCurrentThread(VOID)
{
- return (struct _KTHREAD *)__readgsqword(0x188);
-}
-
+ return (struct _KTHREAD *)__readgsqword(0x188);
+}
+
+_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))
FORCEINLINE
NTSTATUS
-KeSaveFloatingPointState(PVOID FloatingState)
-{
- UNREFERENCED_PARAMETER(FloatingState);
- return STATUS_SUCCESS;
-}
-
+KeSaveFloatingPointState(
+ _Out_ PKFLOATING_SAVE FloatSave)
+{
+ UNREFERENCED_PARAMETER(FloatSave);
+ return STATUS_SUCCESS;
+}
+
+_Success_(1)
+_Kernel_float_restored_
+_At_(*FloatSave, _Kernel_requires_resource_held_(FloatState)
_Kernel_releases_resource_(FloatState))
FORCEINLINE
NTSTATUS
-KeRestoreFloatingPointState(PVOID FloatingState)
-{
- UNREFERENCED_PARAMETER(FloatingState);
- return STATUS_SUCCESS;
+KeRestoreFloatingPointState(
+ _In_ PKFLOATING_SAVE FloatSave)
+{
+ UNREFERENCED_PARAMETER(FloatSave);
+ return STATUS_SUCCESS;
}
/* VOID
Modified: trunk/reactos/include/xdk/amd64/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/amd64/mm.h?rev…
==============================================================================
--- trunk/reactos/include/xdk/amd64/mm.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/amd64/mm.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -27,11 +27,15 @@
extern NTKERNELAPI PVOID MmSystemRangeStart;
extern NTKERNELAPI ULONG64 MmUserProbeAddress;
-#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
-#define MM_SYSTEM_RANGE_START MmSystemRangeStart
-#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
-#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
+#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
+#define MM_SYSTEM_RANGE_START MmSystemRangeStart
+#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_)
+#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_
+extern ULONG64 _LOCAL_COPY_USER_PROBE_ADDRESS_;
+#else
+#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
+#endif
+#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000ULL
$endif /* _NTDDK_ */
-
Modified: trunk/reactos/include/xdk/arm/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/arm/ke.h?rev=6…
==============================================================================
--- trunk/reactos/include/xdk/arm/ke.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/arm/ke.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -1,5 +1,358 @@
$if (_WDMDDK_)
-#include <armddk.h>
+/** Kernel definitions for ARM **/
+
+/* Interrupt request levels */
+#define PASSIVE_LEVEL 0
+#define LOW_LEVEL 0
+#define APC_LEVEL 1
+#define DISPATCH_LEVEL 2
+#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 KIP0PCRADDRESS 0xFFDFF000
+#define KI_USER_SHARED_DATA 0xFFFF9000
+#define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA)
+
+#define PAGE_SIZE 0x1000
+#define PAGE_SHIFT 12L
+
+typedef struct _KFLOATING_SAVE
+{
+ ULONG Reserved;
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+extern NTKERNELAPI volatile KSYSTEM_TIME KeTickCount;
+
+FORCEINLINE
+VOID
+YieldProcessor(
+ VOID)
+{
+ __dmb(_ARM_BARRIER_ISHST);
+ __yield();
+}
+
+#define MemoryBarrier() __dmb(_ARM_BARRIER_SY)
+#define PreFetchCacheLine(l,a) __prefetch((const void *) (a))
+#define PrefetchForWrite(p) __prefetch((const void *) (p))
+#define ReadForWriteAccess(p) (*(p))
+
+FORCEINLINE
+VOID
+KeMemoryBarrier(
+ VOID)
+{
+ _ReadWriteBarrier();
+ MemoryBarrier();
+}
+
+#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))
+FORCEINLINE
+NTSTATUS
+KeSaveFloatingPointState(
+ _Out_ PKFLOATING_SAVE FloatSave)
+{
+ UNREFERENCED_PARAMETER(FloatSave);
+ return STATUS_SUCCESS;
+}
+
+_Success_(1)
+_Kernel_float_restored_
+_At_(*FloatSave, _Kernel_requires_resource_held_(FloatState)
_Kernel_releases_resource_(FloatState))
+FORCEINLINE
+NTSTATUS
+KeRestoreFloatingPointState(
+ _In_ PKFLOATING_SAVE FloatSave)
+{
+ UNREFERENCED_PARAMETER(FloatSave);
+ return STATUS_SUCCESS;
+}
+
+VOID
+KeFlushIoBuffers(
+ _In_ PMDL Mdl,
+ _In_ BOOLEAN ReadOperation,
+ _In_ BOOLEAN DmaOperation);
+
+#define DbgRaiseAssertionFailure() __emit(0xdefc)
+
+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)
+
+#define CP15_PMSELR 15, 0, 9, 12, 5 /* Event Counter Selection Register */
+#define CP15_PMXEVCNTR 15, 0, 9, 13, 2 /* Event Count Register */
+#define CP15_TPIDRURW 15, 0, 13, 0, 2 /* Software Thread ID Register, UsRW */
+#define CP15_TPIDRURO 15, 0, 13, 0, 3 /* Software Thread ID Register, UsRO */
+#define CP15_TPIDRPRW 15, 0, 13, 0, 4 /* Software Thread ID Register, Kernel */
+
+$endif (_WDMDDK_)
+$if (_NTDDK_)
+
+#define PAUSE_PROCESSOR __yield();
+
+#define KERNEL_STACK_SIZE 0x3000
+#define KERNEL_LARGE_STACK_SIZE 0xF000
+#define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
+
+#define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000
+
+#define EXCEPTION_READ_FAULT 0
+#define EXCEPTION_WRITE_FAULT 1
+#define EXCEPTION_EXECUTE_FAULT 8
+
+/* The following flags control the contents of the CONTEXT structure. */
+#define CONTEXT_ARM 0x200000L
+#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
+#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
+#define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008L)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |
CONTEXT_FLOATING_POINT)
+
+typedef struct _NEON128
+{
+ ULONGLONG Low;
+ LONGLONG High;
+} NEON128, *PNEON128;
+
+#define ARM_MAX_BREAKPOINTS 8
+#define ARM_MAX_WATCHPOINTS 1
+
+typedef struct _CONTEXT
+{
+ /* The flags values within this flag control the contents of
+ a CONTEXT record.
+
+ If the context record is used as an input parameter, then
+ for each portion of the context record controlled by a flag
+ whose value is set, it is assumed that that portion of the
+ context record contains valid context. If the context record
+ is being used to modify a thread's context, then only that
+ portion of the threads context will be modified.
+
+ If the context record is used as an IN OUT parameter to capture
+ the context of a thread, then only those portions of the thread's
+ context corresponding to set flags will be returned.
+
+ The context record is never used as an OUT only parameter. */
+ ULONG ContextFlags;
+
+ /* This section is specified/returned if the ContextFlags word contains
+ the flag CONTEXT_INTEGER. */
+ ULONG R0;
+ ULONG R1;
+ ULONG R2;
+ ULONG R3;
+ ULONG R4;
+ ULONG R5;
+ ULONG R6;
+ ULONG R7;
+ ULONG R8;
+ ULONG R9;
+ ULONG R10;
+ ULONG R11;
+ ULONG R12;
+
+ ULONG Sp;
+ ULONG Lr;
+ ULONG Pc;
+ ULONG Cpsr;
+
+ /* Floating Point/NEON Registers */
+ ULONG Fpscr;
+ ULONG Padding;
+ union
+ {
+ NEON128 Q[16];
+ ULONGLONG D[32];
+ ULONG S[32];
+ } DUMMYUNIONNAME;
+
+ /* Debug registers */
+ ULONG Bvr[ARM_MAX_BREAKPOINTS];
+ ULONG Bcr[ARM_MAX_BREAKPOINTS];
+ ULONG Wvr[ARM_MAX_WATCHPOINTS];
+ ULONG Wcr[ARM_MAX_WATCHPOINTS];
+
+ ULONG Padding2[2];
+} CONTEXT;
+
+#define PCR_MINOR_VERSION 1
+#define PCR_MAJOR_VERSION 1
+
+typedef struct _KPCR
+{
+ _ANONYMOUS_UNION union
+ {
+ NT_TIB NtTib;
+ _ANONYMOUS_STRUCT struct
+ {
+ ULONG TibPad0[2];
+ PVOID Spare1;
+ struct _KPCR *Self;
+ struct _KPRCB *CurrentPrcb;
+ PKSPIN_LOCK_QUEUE LockArray;
+ PVOID Used_Self;
+ };
+ };
+ KIRQL CurrentIrql;
+ UCHAR SecondLevelCacheAssociativity;
+ ULONG Unused0[3];
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+ ULONG StallScaleFactor;
+ PVOID Unused1[3];
+ ULONG KernelReserved[15];
+ ULONG SecondLevelCacheSize;
+ _ANONYMOUS_UNION union
+ {
+ USHORT SoftwareInterruptPending; // Software Interrupt Pending Flag
+ struct
+ {
+ UCHAR ApcInterrupt; // 0x01 if APC int pending
+ UCHAR DispatchInterrupt; // 0x01 if dispatch int pending
+ };
+ };
+ USHORT InterruptPad;
+ ULONG HalReserved[32];
+ PVOID KdVersionBlock;
+ PVOID Unused3;
+ ULONG PcrAlign1[8];
+} KPCR, *PKPCR;
+
+#define CP15_PCR_RESERVED_MASK 0xFFF
+//#define KIPCR() ((ULONG_PTR)(_MoveFromCoprocessor(CP15_TPIDRPRW)) &
~CP15_PCR_RESERVED_MASK)
+
+FORCEINLINE
+PKPCR
+KeGetPcr(
+ VOID)
+{
+ return (PKPCR)(_MoveFromCoprocessor(CP15_TPIDRPRW) & ~CP15_PCR_RESERVED_MASK);
+}
+
+#if (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS)
+FORCEINLINE
+ULONG
+KeGetCurrentProcessorNumber(
+ VOID)
+
+{
+ return *((PUCHAR)KeGetPcr() + 0x580);
+}
+#endif /* (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS) */
+
$endif
-
-#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
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] Sun May 10 19:34:38 2015
@@ -1097,10 +1097,10 @@
#define XSTATE_LEGACY_SSE 1
#define XSTATE_GSSE 2
-#define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 <<
(XSTATE_LEGACY_FLOATING_POINT))
-#define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE))
+#define XSTATE_MASK_LEGACY_FLOATING_POINT (1LL <<
(XSTATE_LEGACY_FLOATING_POINT))
+#define XSTATE_MASK_LEGACY_SSE (1LL << (XSTATE_LEGACY_SSE))
#define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT |
XSTATE_MASK_LEGACY_SSE)
-#define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE))
+#define XSTATE_MASK_GSSE (1LL << (XSTATE_GSSE))
#define MAXIMUM_XSTATE_FEATURES 64
Modified: trunk/reactos/include/xdk/ntbasedef.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/ntbasedef.h?re…
==============================================================================
--- trunk/reactos/include/xdk/ntbasedef.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/ntbasedef.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -757,7 +757,7 @@
#define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned
__int64)(unsigned int)(b))
#endif
-#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE)
+#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE) || defined(_M_ARM)
/* Use native math */
#define Int64ShllMod32(a,b) ((unsigned __int64)(a)<<(b))
#define Int64ShraMod32(a,b) (((__int64)(a))>>(b))
Modified: trunk/reactos/include/xdk/ntddk.template.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/ntddk.template…
==============================================================================
--- trunk/reactos/include/xdk/ntddk.template.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/ntddk.template.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -117,6 +117,7 @@
$include(mips/ke.h)
#elif defined(_M_ARM)
$include(arm/ke.h)
+$include(arm/mm.h)
#else
#error Unknown Architecture
#endif
Modified: trunk/reactos/include/xdk/winnt_old.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/winnt_old.h?re…
==============================================================================
--- trunk/reactos/include/xdk/winnt_old.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/winnt_old.h [iso-8859-1] Sun May 10 19:34:38 2015
@@ -2412,13 +2412,19 @@
/* The following flags control the contents of the CONTEXT structure. */
-#define CONTEXT_ARM 0x0000040
+#define CONTEXT_ARM 0x200000L
#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
-
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
-
-typedef struct _NEON128 {
+#define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008L)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |
CONTEXT_FLOATING_POINT)
+
+#define EXCEPTION_READ_FAULT 0
+#define EXCEPTION_WRITE_FAULT 1
+#define EXCEPTION_EXECUTE_FAULT 8
+
+typedef struct _NEON128
+{
ULONGLONG Low;
LONGLONG High;
} NEON128, *PNEON128;
@@ -2426,7 +2432,8 @@
#define ARM_MAX_BREAKPOINTS 8
#define ARM_MAX_WATCHPOINTS 1
-typedef struct _CONTEXT {
+typedef struct _CONTEXT
+{
/* The flags values within this flag control the contents of
a CONTEXT record.
@@ -2442,7 +2449,6 @@
context corresponding to set flags will be returned.
The context record is never used as an OUT only parameter. */
-
DWORD ContextFlags;
/* This section is specified/returned if the ContextFlags word contains
@@ -2469,7 +2475,8 @@
/* Floating Point/NEON Registers */
DWORD Fpscr;
DWORD Padding;
- union {
+ union
+ {
NEON128 Q[16];
ULONGLONG D[32];
DWORD S[32];
Modified: trunk/reactos/ntoskrnl/include/internal/arm/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] Sun May 10 19:34:38
2015
@@ -3,6 +3,9 @@
#include "intrin_i.h"
#define KiServiceExit2 KiExceptionExit
+
+#define SYNCH_LEVEL DISPATCH_LEVEL
+#define PCR ((KPCR * const)KIP0PCRADDRESS)
//
//Lockdown TLB entries
@@ -16,6 +19,11 @@
#define KD_BREAKPOINT_TYPE ULONG
#define KD_BREAKPOINT_SIZE sizeof(ULONG)
//#define KD_BREAKPOINT_VALUE
+
+//
+// Maximum IRQs
+//
+#define MAXIMUM_VECTOR 16
//
// Macros for getting and setting special purpose registers in portable code
@@ -137,6 +145,19 @@
VOID
);
+//
+// Cache clean and flush
+//
+VOID
+HalSweepDcache(
+ VOID
+);
+
+VOID
+HalSweepIcache(
+ VOID
+);
+
#define Ki386PerfEnd()
#define KiEndInterrupt(x,y)
Modified: trunk/reactos/ntoskrnl/include/internal/arm/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/mm.h [iso-8859-1] Sun May 10 19:34:38
2015
@@ -14,11 +14,6 @@
#define MI_PAGED_POOL_START (PVOID)0xE1000000
#define MI_NONPAGED_POOL_END (PVOID)0xFFBE0000
#define MI_DEBUG_MAPPING (PVOID)0xFFBFF000
-
-#define PTE_BASE 0xC0000000
-#define PDE_BASE 0xC0400000
-#define PDE_TOP 0xC04FFFFF
-#define PTE_TOP 0xC03FFFFF
#define PTE_PER_PAGE 256
#define PDE_PER_PAGE 4096