https://git.reactos.org/?p=reactos.git;a=commitdiff;h=31afbf10545d07b33d4183d203d630fca76cff2d

commit 31afbf10545d07b33d4183d203d630fca76cff2d
Author:     Jérôme Gardou <jerome.gar...@reactos.org>
AuthorDate: Fri Mar 26 09:32:34 2021 +0100
Commit:     Jérôme Gardou <zefk...@users.noreply.github.com>
CommitDate: Tue May 4 12:02:41 2021 +0200

    [NTOS] Make some internal headers C++ aware
---
 ntoskrnl/include/internal/ex.h            |  9 +++++++++
 ntoskrnl/include/internal/i386/intrin_i.h | 19 +++++++++++++++----
 ntoskrnl/include/internal/i386/ke.h       |  9 +++++++++
 ntoskrnl/include/internal/ke.h            |  9 +++++++++
 ntoskrnl/include/internal/ke_x.h          |  9 +++++++++
 ntoskrnl/include/internal/mm.h            |  7 +++++++
 ntoskrnl/mm/ARM3/miarm.h                  | 27 ++++++++++-----------------
 7 files changed, 68 insertions(+), 21 deletions(-)

diff --git a/ntoskrnl/include/internal/ex.h b/ntoskrnl/include/internal/ex.h
index 3dcc38ff944..4a0e94d7da4 100644
--- a/ntoskrnl/include/internal/ex.h
+++ b/ntoskrnl/include/internal/ex.h
@@ -1,5 +1,10 @@
 #pragma once
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /* GLOBAL VARIABLES *********************************************************/
 
 extern RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo;
@@ -1513,3 +1518,7 @@ XIPInit(
 
 #define ExfInterlockedCompareExchange64UL(Destination, Exchange, Comperand) \
    (ULONGLONG)ExfInterlockedCompareExchange64((PLONGLONG)(Destination), 
(PLONGLONG)(Exchange), (PLONGLONG)(Comperand))
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/ntoskrnl/include/internal/i386/intrin_i.h 
b/ntoskrnl/include/internal/i386/intrin_i.h
index a458be957fb..4bdd8707449 100644
--- a/ntoskrnl/include/internal/i386/intrin_i.h
+++ b/ntoskrnl/include/internal/i386/intrin_i.h
@@ -1,12 +1,17 @@
 #pragma once
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 #if defined(__GNUC__)
 
 FORCEINLINE
 VOID
 __lgdt(_Out_ PVOID Descriptor)
 {
-    PVOID* desc = Descriptor;
+    PVOID* desc = (PVOID*)Descriptor;
     __asm__ __volatile__(
         "lgdt %0"
             : "=m" (*desc)
@@ -18,7 +23,7 @@ FORCEINLINE
 VOID
 __sgdt(_Out_ PVOID Descriptor)
 {
-    PVOID* desc = Descriptor;
+    PVOID* desc = (PVOID*)Descriptor;
     __asm__ __volatile__(
         "sgdt %0"
             : "=m" (*desc)
@@ -301,11 +306,11 @@ Ke386SaveFpuState(IN PVOID SaveArea)
 {
     if (KeI386FxsrPresent)
     {
-        __fxsave(SaveArea);
+        __fxsave((PFX_SAVE_AREA)SaveArea);
     }
     else
     {
-        __fnsave(SaveArea);
+        __fnsave((PFLOATING_SAVE_AREA)SaveArea);
     }
 }
 
@@ -319,8 +324,14 @@ Ke386SaveFpuState(IN PVOID SaveArea)
 #error Unknown compiler for inline assembler
 #endif
 
+
 #define Ke386GetGlobalDescriptorTable __sgdt
 #define Ke386SetGlobalDescriptorTable __lgdt
 #define Ke386GetLocalDescriptorTable __sldt
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+
 /* EOF */
diff --git a/ntoskrnl/include/internal/i386/ke.h 
b/ntoskrnl/include/internal/i386/ke.h
index 58adbf52906..71e302b4dde 100644
--- a/ntoskrnl/include/internal/i386/ke.h
+++ b/ntoskrnl/include/internal/i386/ke.h
@@ -4,6 +4,11 @@
 
 #include "intrin_i.h"
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 //
 // Thread Dispatcher Header DebugActive Mask
 //
@@ -887,4 +892,8 @@ KiGetUserModeStackAddress(void)
     return &(KeGetCurrentThread()->TrapFrame->HardwareEsp);
 }
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif
diff --git a/ntoskrnl/include/internal/ke.h b/ntoskrnl/include/internal/ke.h
index 2310d4232fe..884db0413c0 100644
--- a/ntoskrnl/include/internal/ke.h
+++ b/ntoskrnl/include/internal/ke.h
@@ -4,6 +4,11 @@
 
 #include "arch/ke.h"
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /* INTERNAL KERNEL TYPES ****************************************************/
 
 typedef struct _WOW64_PROCESS
@@ -1049,4 +1054,8 @@ KeBugCheckUnicodeToAnsi(
     IN ULONG Length
 );
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #include "ke_x.h"
diff --git a/ntoskrnl/include/internal/ke_x.h b/ntoskrnl/include/internal/ke_x.h
index 84cb68e2c76..5bd084d0e14 100644
--- a/ntoskrnl/include/internal/ke_x.h
+++ b/ntoskrnl/include/internal/ke_x.h
@@ -6,6 +6,11 @@
 * PROGRAMMERS:     Alex Ionescu (alex.ione...@reactos.org)
 */
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 #ifndef _M_ARM
 FORCEINLINE
 KPROCESSOR_MODE
@@ -1701,3 +1706,7 @@ KiCpuIdEx(
     __cpuidex((INT*)CpuInfo->AsUINT32, Function, SubFunction);
 }
 #endif /* _M_IX86 || _M_AMD64 */
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h
index 6f9d6f57f40..5eab082b3f2 100644
--- a/ntoskrnl/include/internal/mm.h
+++ b/ntoskrnl/include/internal/mm.h
@@ -2,6 +2,10 @@
 
 #include <internal/arch/mm.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* TYPES *********************************************************************/
 
 struct _EPROCESS;
@@ -1641,3 +1645,6 @@ MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
                     IN KPROCESSOR_MODE PreviousMode,
                     OUT PSIZE_T ReturnSize);
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/ntoskrnl/mm/ARM3/miarm.h b/ntoskrnl/mm/ARM3/miarm.h
index 053ae8047dd..caef296e079 100644
--- a/ntoskrnl/mm/ARM3/miarm.h
+++ b/ntoskrnl/mm/ARM3/miarm.h
@@ -8,6 +8,10 @@
 
 #pragma once
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define MI_LOWEST_VAD_ADDRESS                   (PVOID)MM_LOWEST_USER_ADDRESS
 
 /* Make the code cleaner with some definitions for size multiples */
@@ -575,7 +579,6 @@ extern PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor;
 extern MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor;
 extern ULONG_PTR MxPfnAllocation;
 extern MM_PAGED_POOL_INFO MmPagedPoolInfo;
-extern RTL_BITMAP MiPfnBitMap;
 extern KGUARDED_MUTEX MmPagedPoolMutex;
 extern KGUARDED_MUTEX MmSectionCommitMutex;
 extern PVOID MmPagedPoolStart;
@@ -627,7 +630,6 @@ extern PFN_NUMBER MmMinimumFreePages;
 extern PFN_NUMBER MmPlentyFreePages;
 extern SIZE_T MmMinimumStackCommitInBytes;
 extern PFN_COUNT MiExpansionPoolPagesInitialCharge;
-extern PFN_NUMBER MmResidentAvailablePages;
 extern PFN_NUMBER MmResidentAvailableAtInit;
 extern ULONG MmTotalFreeSystemPtes[MaximumPtePoolTypes];
 extern PFN_NUMBER MmTotalSystemDriverPages;
@@ -1076,10 +1078,9 @@ MI_WS_OWNER(IN PEPROCESS Process)
 //
 FORCEINLINE
 BOOLEAN
-MiIsRosSectionObject(IN PVOID Section)
+MiIsRosSectionObject(IN PSECTION Section)
 {
-    PSECTION RosSection = Section;
-    return RosSection->u.Flags.filler;
+    return Section->u.Flags.filler;
 }
 
 #define MI_IS_ROS_PFN(x)     ((x)->u4.AweAllocation == TRUE)
@@ -1941,12 +1942,6 @@ MiCheckPdeForPagedPool(
     IN PVOID Address
 );
 
-VOID
-NTAPI
-MiInitializeNonPagedPool(
-    VOID
-);
-
 VOID
 NTAPI
 MiInitializeNonPagedPoolThresholds(
@@ -2393,12 +2388,6 @@ MiRosUnmapViewInSystemSpace(
     IN PVOID MappedBase
 );
 
-POOL_TYPE
-NTAPI
-MmDeterminePoolType(
-    IN PVOID PoolAddress
-);
-
 VOID
 NTAPI
 MiMakePdeExistAndMakeValid(
@@ -2450,4 +2439,8 @@ MiSynchronizeSystemPde(PMMPDE PointerPde)
 }
 #endif
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 /* EOF */

Reply via email to