[DEBUG.H] Add a _WARN macro to emit compiler warning messages (also adds __STRLINE__...
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 22 Sep 2013 21:19:40 +0000 (21:19 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 22 Sep 2013 21:19:40 +0000 (21:19 +0000)
[NTOSKRNL] Fix some x64 issues and warn about unimplemented session space stuff on x64

svn path=/trunk/; revision=60327

reactos/include/reactos/debug.h
reactos/ntoskrnl/mm/ARM3/pagfault.c

index f467dc8..03db1b6 100644 (file)
@@ -230,4 +230,18 @@ do {                                                        \
 #define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
 #define ASSERT_IRQL_LESS(x) ASSERT(KeGetCurrentIrql()<(x))
 
 #define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
 #define ASSERT_IRQL_LESS(x) ASSERT(KeGetCurrentIrql()<(x))
 
+#define __STRING2__(x) #x
+#define __STRING__(x) __STRING2__(x)
+#define __STRLINE__ __STRING__(__LINE__)
+
+#define __TOKENPASTE2__(x, y) x ## y
+#define __TOKENPASTE__(x, y) __TOKENPASTE2__(x, y)
+
+#ifdef _MSC_VER
+#define _WARN(msg) __pragma(message("WARNING! Line " __STRLINE__ ": " msg))
+#else
+#define _WARN1(_func1, _func2, _msg) void __attribute__((warning (_msg))) _func1(void); void __attribute__((used)) _func2(void) { _func1(); }
+#define _WARN(_msg) _WARN1(__TOKENPASTE__(__warn_func1__, __LINE__), __TOKENPASTE__(__warn_func2__, __LINE__), _msg)
+#endif
+
 #endif /* __INTERNAL_DEBUG */
 #endif /* __INTERNAL_DEBUG */
index 1794789..e29dc53 100644 (file)
@@ -32,7 +32,7 @@ MiCheckForUserStackOverflow(IN PVOID Address,
     PETHREAD CurrentThread = PsGetCurrentThread();
     PTEB Teb = CurrentThread->Tcb.Teb;
     PVOID StackBase, DeallocationStack, NextStackAddress;
     PETHREAD CurrentThread = PsGetCurrentThread();
     PTEB Teb = CurrentThread->Tcb.Teb;
     PVOID StackBase, DeallocationStack, NextStackAddress;
-    ULONG GuranteedSize;
+    SIZE_T GuranteedSize;
     NTSTATUS Status;
 
     /* Do we own the address space lock? */
     NTSTATUS Status;
 
     /* Do we own the address space lock? */
@@ -116,7 +116,7 @@ NTAPI
 MiAccessCheck(IN PMMPTE PointerPte,
               IN BOOLEAN StoreInstruction,
               IN KPROCESSOR_MODE PreviousMode,
 MiAccessCheck(IN PMMPTE PointerPte,
               IN BOOLEAN StoreInstruction,
               IN KPROCESSOR_MODE PreviousMode,
-              IN ULONG ProtectionCode,
+              IN ULONG_PTR ProtectionCode,
               IN PVOID TrapFrame,
               IN BOOLEAN LockHeld)
 {
               IN PVOID TrapFrame,
               IN BOOLEAN LockHeld)
 {
@@ -1496,7 +1496,7 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
                 return STATUS_SUCCESS;
             }
         }
                 return STATUS_SUCCESS;
             }
         }
-
+#if (_MI_PAGING_LEVELS == 2)
         /* Check if this was a session PTE that needs to remap the session PDE */
         if (MI_IS_SESSION_PTE(Address))
         {
         /* Check if this was a session PTE that needs to remap the session PDE */
         if (MI_IS_SESSION_PTE(Address))
         {
@@ -1512,6 +1512,11 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
                              6);
             }
         }
                              6);
             }
         }
+#else
+
+_WARN("Session space stuff is not implemented yet!")
+
+#endif
 
         /* Check for a fault on the page table or hyperspace */
         if (MI_IS_PAGE_TABLE_OR_HYPER_ADDRESS(Address))
 
         /* Check for a fault on the page table or hyperspace */
         if (MI_IS_PAGE_TABLE_OR_HYPER_ADDRESS(Address))
@@ -1970,7 +1975,7 @@ UserFault:
     else
     {
         /* Get the protection code and check if this is a proto PTE */
     else
     {
         /* Get the protection code and check if this is a proto PTE */
-        ProtectionCode = TempPte.u.Soft.Protection;
+        ProtectionCode = (ULONG)TempPte.u.Soft.Protection;
         if (TempPte.u.Soft.Prototype)
         {
             /* Do we need to go find the real PTE? */
         if (TempPte.u.Soft.Prototype)
         {
             /* Do we need to go find the real PTE? */